1.0.1 • Published 3 years ago

iview-upload v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

iview-upload

基于 iview 进行二次开发的图片上传组件,支持上传后本地图片回显、私密图片回显不显示具体图片、上传前压缩、集成 viewjs 全屏预览插件(注:使用前先引入 iview,否则无法使用)

安装

npm install iview-upload --save

引入

import uploadCustom from "iview-upload";

在引入的 vue 模块中需要在 components 上注册这个组件,这样才可以正常使用这个组件:

export default {
  name: 'app',
  components:{
    uploadCustom
  },
  data () {
     return {
        ...
     }
  },
  ...
}

效果

多选效果

调用方式

<upload-custom v-model="val"></upload-custom>

参数说明

属性说明类型默认版本
action 上传的地址,必填String1.0.0
headers设置上传的请求头部Object-1.0.0
fileData初始图片数据String1.0.0
params上传时附带的额外参数Object-1.0.0
readonly是否只读Objectfalse1.0.0
noShow隐私图片不展示具体Objectfalse1.0.0
maxSize文件大小限制,单位 byteNumber2 1024 10241.0.0
format支持的文件类型,识别文件的后缀名Array[]
autoCompress支持上传前自动压缩Booleanfalse
maxWidth图片最大宽度,超过则压缩,autoCompress 为 true 时生效Number2000
maxHeight图片最大高度,超过则压缩,autoCompress 为 true 时生效Number2000

方法说明

方法说明返回值
on-success上传成功response, file
on-remove文件移除
on-progress文件上传时返回file
1.0.1

3 years ago

1.0.0

3 years ago