npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ph-image-upload

v1.0.2

Published

trade f2e project

Downloads

3

Readme

ph-image-upload

upload image or other file

demo地址 https://future-team.github.io/ph-image-upload/example/index.html

 <ImgUpload multiple
            className='my-class'
            filter={::this.filter}
            successCallback={::this.successCallback}
            failCallback={::this.failCallback}
            completeCallback={::this.completeCallback}
            uploadUrl="http://beta.ask.sankuai.com/attachment/upload" >
            <label style={{display:'inline-block',width:'100px',height:'100px'}}>
                这是一个上传按钮
            </label>
</ImgUpload>
 funnction filter(files, maxSize) {
        var arrFiles = [];
        for (var i = 0, file; file = files[i]; i++) {
            if (file.type.indexOf("image") == 0 || file.type.indexOf("pdf") >= 0 || file.type.indexOf("msword") >= 0
                || file.type.indexOf("vnd.openxmlformats-officedocument.wordprocessingml.document") >= 0
                || file.type.indexOf("csv") >= 0 || file.type.indexOf("vnd.ms-excel") >= 0
                || file.type.indexOf("vnd.openxmlformats-officedocument.spreadsheetml.sheet") >= 0
                || file.type.indexOf("vnd.openxmlformats-officedocument.presentationml.presentation") >= 0
                || file.type.indexOf("vnd.ms-powerpoint") >= 0) {
                arrFiles.push(file);
            }else {
                alert('只能上传图片、doc、docx、xls、xlsx、pdf文件,上传文件"' + file.name + '"错误。');
            }
        }
        return arrFiles;
    }
    funnction successCallback(file,response){
        console.log('success',file,response);
    }
    funnction failCallback(file,response){
        console.log('fail',file,response);
    }
    funnction completeCallback(uploadInfo,successNum){
        console.log('complete',uploadInfo,successNum)
    }

API

View example to get more details

<ImgUpload> Props:

  • multiple 用来控制input file 的单选和多选 .
  • successCallback 每当上传成功一个文件,该方法都会被调用.
  • failCallback 每当一个文件上传失败,该方法都会被调用.
  • beforeUploadCallback 当文件开始上传前调用.
  • completeCallback 当所有文件都成功上传后,该方法会被调用.
  • filter: 用于过滤用户选择的文件
  • uploadUrl: 上传地址
  • disabled: 是否禁止上传
  • chooseFile方法 通过给ImgUpload添加ref的形式,可以通过chooseFile方法来手动触发上传图片

Contributing

  • Fork the project
  • Run the project in development view demo: $ npm run demo
  • Make changes.
  • Add appropriate tests
  • $ npm run test
  • If tests don't pass, make them pass.
  • Update README with appropriate docs.
  • Rnn build
  • $ npm run build
  • Commit and PR.