jsmom-file-upload
Version:
文件上传
51 lines (40 loc) • 1.25 kB
Markdown
# vue 文件上传组件
## 安装
> npm i jsmom-file-upload -S
or
> yarn add jsmom-file-upload
## 使用
- 引入
```javascript
import FileUpload from "jsmom-file-upload";
```
- 注册
```javascript
components: {
FileUpload,
}
```
- 页面
```html
<FileUpload :uploadedFileList="fileList" :limit="3" :configData="{}">
<el-button>点击上传</el-button>
</FileUpload>
```
## 配置
- uploadedFileList 文件列表 `Array<{id:String|Number,name:String}>`
- limit 限制文件数 `Number`
- accept 文件类型 `String`
- showFileList 显示已上传列表 `Boolean` 默认 false
- beforeUpload 上传文件之前的钩子,参数为上传的文件列表,若返回 false 或者返回 Promise 且被 reject,则停止上传。 `Function`
- configData `Object`
- chunkSize `Number` 分块大小,单位字节 default:2048000
- fileCheckUrl `String` 检查服务器文件是上传情况
- fileUploadUrl `String` 文件上传 URL
- fileMergeUrl `String` 请求文件合并 URL
- fromTable `String` 关联表
- fromKey `String` 关联 key
- headers `Object` 请求头信息
- baseApi `String` 请求地址
- slot 点击上传
## 实例
_待补充_