文件上传控件
Properties:
Name |
Type |
Description |
props |
object
|
组件属性,内容如下
Properties
Name |
Type |
Description |
fieldName |
string
|
input=file的name属性 |
style |
object
|
样式对象 |
className |
string
|
样式类名称 |
disabled |
boolean
|
是否禁用 |
component |
string
|
输出元素,默认为div,可选span等 |
action |
string
|
function
|
promise
|
上传文件地址 |
method |
string
|
请求方式,默认POST |
data |
object
|
fuction
|
请求传递的其他对象、或者返回对象的一个函数,函数参数file为文件对象 |
headers |
object
|
请求头信息 |
accept |
string
|
input=file的accept属性 |
capture |
string
|
input=file的capture属性 |
multiple |
boolean
|
多文件上传 |
onStart |
function
|
事件:开始上传 |
onError |
function
|
事件:上传异常,参数:event, body, file |
onSuccess |
function
|
事件:上传成功 |
onProgress |
function
|
事件:上传进度,(event: { percent: number }): void |
beforeUpload |
function
|
promise
|
开始上传前回调:1. 如果返回false,将停止上传,2.参数file为单文件对象 |
|
Examples
组件引入
// 全局模块引入
import { Upload } from '@ccreator/smart-ui';
// 最小化模块引入
import Upload from '@ccreator/smart-ui/dist/Upload';
使用示例
<Upload />