1.1.3 • Published 7 years ago
vue2-file-upload v1.1.3
vue2-file-upload
vue文件上传组件支持拖动上传 支持显示进度条,大文件上传比较友好
安装
npm install vue2-file-upload -S
使用
// ES6
import vue2FileUpload from 'vue2-file-upload.js'
// 导入
Vue.use(vue2FileUpload)
// 作为组件的方式使用
<vue2-file-upload></vue2-file-upload>
配置
<vue2-file-upload
title="将APK拖拽到此区域或者点击上传"
url='http://xxx.com'
@schedule="schedule"
@out="out"></vue2-file-upload>
methods:{
// 成功拿到的后端返回
out(ev){
console.log(ev)
}
// 上传过程中拿到的进度
schedule(ev){
console.log(ev)
}
}
Props
name | Description | type | default |
---|---|---|---|
title | 框里面显示的文字 | String | |
accept | 需要限制的文件类型 | String | * |
color | 文字颜色 | String | #d3d3d3 |
border | 边框 | String | 3px dashed silver |
hoverColor | 拖入文字颜色 | String | rgb(32,160,255) |
hoverBorder | 拖入边框 | String | 3px dashed rgb(32,160,255) |
url | 请求的地址 | String | |
isFooter | 是否显示底部 | Boolean | true |
isApk | 是否限制APK格式 | Boolean | true |
Events
name | Description |
---|---|
schedule | 上传过程中触发事件 |
out | 上传完成触发事件 |