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

ct-adc-importer

v2.0.0

Published

A Vue.js project

Downloads

7

Readme

导入文件组件

在线demo

使用

从npm安装ct-adc-importer

npm install ct-adc-importer

在代码中引用

import Importer from 'ct-adc-importer';
//全局注册
Vue.component(Importer.name,Importer);

//局部注册

new Vue({
    ...
    components:{
        Importer
    },
    ...
})

参数说明

参数|描述|类型|默认值 --- | --- | --- | --- | buttonText | 按钮文字 | String | '导入文件' server | 上传接口地址 | String | '' method | 上传方式 | String | 'POST' accept | 和webuploader中accept配置项一致,包含extensions和mimeTypes两项。详见下方说明 | Object | null fileSizeLimit | 可以接受的文件大小(单位为B) | Number | undefined formData | 随文件上传的参数 | Object | {} chunked | 是否分片上传文件 | Boolean | true disabled | 按钮是否可用 | Boolean | true tip | disabled为false时生效。当tip为''时不显示tip框 | String | '' direction | tip的方向 | String | 'left'/'right'/'top'/'bottom' hasInput | 是否需要input框 | Boolean | false inputPlaceholder | input框的placeholder | String | '请上传一个文件' headers | 自己需要配置的请求头 | Object | {} auto | 自动或者是手动上传文件 | Boolean | false sendAsBinary | 是否以二进制流方式上传 | Boolean | false multiple | 是否支持文件多选 | Boolean | false compress | 是否需要压缩 | false(Boolean) 或 Object(详细见下) | false

accept

accept参数为一个对象,包含两项:

  • extensions

以‘,’隔开 如 jpg,png,gif

  • mimeTypes

文件类型,如'image/jpeg'. 请具体列出文件类型,避免类似'image/*'这样的写法。

compress

{
    width: 1600,
    height: 1600,

    // 图片质量,只有type为`image/jpeg`的时候才有效。
    quality: 90,

    // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
    allowMagnify: false,

    // 是否允许裁剪。
    crop: false,

    // 是否保留头部meta信息。
    preserveHeaders: true,

    // 如果发现压缩后文件大小比原来还大,则使用原来图片
    // 此属性可能会影响图片自动纠正功能
    noCompressIfLarger: false,

    // 单位字节,如果图片大小小于此值,不会采用压缩。
    compressSize: 0
}

事件说明

success

成功后的回调,参数为服务端响应内容

error

失败后的回调,参数为错误信息。 错误信息为字符串,内容不固定。 如果是http且状态码需要客户端解析(状态码除去[200,300)和[500,600)后其他的状态码),会返回如"http-401"这种错误。 如需解析,请先解析状态码,如果无状态码信息,则提示默认的提示如“上传失败,请重试”

ps: 上传后的逻辑层面的失败需要在外部处理。

依赖列表

此处的依赖列表是指需要用户手动引入到全局的js资源

  1. webuploader

内部引用地址 http://static.uc108.com/cdn/webuploader/0.1.6/webuploader.html5only.min.js