0.0.6 • Published 3 years ago
zt-drag-upload-button v0.0.6
ZtDragUploadButton
Install
npm i zt-drag-upload-buttonProperties
| 字段 | 类别 | 介绍 | 默认值 | 必填 |
|---|---|---|---|---|
| children | React.ReactNode | _ | 否 | |
| className | string | dom的classname | _ | 否 |
| style | CSSProperties | dom的style | _ | 否 |
| count | number | 允许上传最大文件数 | 1 | 否 |
| accept | string | 同input的accept | _ | 否 |
| url | string | 上传api地址 | _ | 如果未填uploadMethod及onFileSelected则必填,否则不必填 |
| beforeUpload | (fileList: FileList) => boolean | 上传前回调 | _ | 否 |
| onError | (error: any) => void | 文件上传失败回调 | _ | 否 |
| onChange | (value: any) => void | 文件上传成功回调(count为1时value为string类型,否则为array类型) | _ | 否 |
| uploadMethod | (file: File) => Promise | 自定义上传方法 | _ | 否 |
| onFileSelected | () => Promise | 自定义文件选择器及上传(传入该方法将覆盖url及uploadMethod) | _ | 否 |