Upload 上传 
规则 
js
{
    type: "upload",
    field: "pic",
    title: "轮播图",
    value: [
        'http://img1.touxiang.cn/uploads/20131030/30-075657_191.jpg',
        'http://img1.touxiang.cn/uploads/20131030/30-075657_191.jpg'
        ],
    props: {
        action: "/upload.php",
        limit: 2,
            onSuccess:function (file) {
            file.url = file.response.url;
        }
    },
}完整配置项:Ant-design-vue_Upload
value :Array | String
注意
文件上传成功后需要通过 onSuccess 回调, 将接口返回内容中的 url 赋值给 file.url.否则表单获取不到组件的数据
Props 
| 参数 | 说明 | 类型 | 默认值 | 
|---|---|---|---|
| onSuccess | 用于获取文件链接 file.url = file.response.url | Function(file,fileList) | 无 | 
| accept | 接受上传的文件类型, 详见 input accept Attribute | string | - | 
| action | 上传的地址 | string|(file) => Promise | - | 
| beforeUpload | 上传文件之前的钩子,参数为上传的文件,若返回 false则停止上传。支持返回一个 Promise 对象,Promise 对象 reject 时则停止上传,resolve 时开始上传( resolve 传入File或Blob对象则上传 resolve 传入对象)。 | (file, fileList) => boolean | Promise | 
| customRequest | 通过覆盖默认的上传行为,可以自定义自己的上传实现 | function | - | 
| data | 上传所需参数或返回上传参数的方法 | object|(file) => object | - | 
| directory | 支持上传文件夹(caniuse) | boolean | false | 
| disabled | 是否禁用 | boolean | - | 
| downloadIcon | 自定义下载 icon | v-slot:iconRender="{file: UploadFile}" | - | 
| fileList | 已经上传的文件列表(受控) | object[] | - | 
| headers | 设置上传的请求头部,IE10 以上有效 | object | - | 
| iconRender | 自定义显示 icon | v-slot:iconRender="{file: UploadFile, listType?: UploadListType}" | - | 
| isImageUrl | 自定义缩略图是否使用 | (file: UploadFile) => boolean | - | 
| itemRender | 自定义上传列表项 | v-slot:itemRender="{originNode: VNode, file: UploadFile, fileList: object[], actions: { download: function, preview: function, remove: function }" | - | 
| listType | 上传列表的内建样式,支持三种基本样式 text,picture和picture-card | string | text | 
| maxCount | 限制上传数量。当为 1 时,始终用最新上传的文件代替当前文件 | number | - | 
| method | 上传请求的 http method | string | post | 
| multiple | 是否支持多选文件, ie10+支持。开启后按住 ctrl 可选择多个文件。 | boolean | false | 
| name | 发到后台的文件参数名 | string | file | 
| openFileDialogOnClick | 点击打开文件对话框 | boolean | true | 
| previewFile | 自定义文件预览逻辑 | (file: File | Blob) => Promise<dataURL: string> | - | 
| previewIcon | 自定义预览 icon | v-slot:iconRender="{file: UploadFile}" | - | 
| progress | 自定义进度条样式 | ProgressProps(仅支持 type="line") | { strokeWidth: 2, showInfo: false } | 
| removeIcon | 自定义删除 icon | v-slot:iconRender="{file: UploadFile}" | - | 
| showUploadList | 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon, showRemoveIcon 和 showDownloadIcon | boolean | { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | 
| supportServerRender | 服务端渲染时需要打开这个 | boolean | false | 
| withCredentials | 上传请求时是否携带 cookie | boolean | false | 
Events 
| 事件名称 | 说明 | 回调参数 | 
|---|---|---|
| change | 上传文件改变时的状态,详见 change | function | 
| download | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页。 | function(file): void | 
| drop | 当文件被拖入上传区域时执行的回调功能 | (event: DragEvent) => void | 
| preview | 点击文件链接或预览图标时的回调 | function(file) | 
| reject | 拖拽文件不符合 accept 类型时的回调 | function(fileList) | 
| remove | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除 | function(file): boolean | Promise | 
UploadFile 
继承自 File,附带额外属性用于渲染。
| 参数 | 说明 | 类型 | 默认值 | 
|---|---|---|---|
| crossOrigin | CORS 属性设置 | 'anonymous'|'use-credentials'|'' | - | 
| name | 文件名 | string | - | 
| percent | 上传进度 | number | - | 
| status | 上传状态,不同状态展示颜色也会有所不同 | error|success|done|uploading|removed | - | 
| thumbUrl | 缩略图地址 | string | - | 
| uid | 唯一标识符,不设置时会自动生成 | string | - | 
| url | 下载地址 | string | - | 
change 
上传中、完成、失败都会调用这个函数。
文件状态改变的回调,返回为:
jsx
{
  file: { /* ... */ },
  fileList: [ /* ... */ ],
  event: { /* ... */ },
}- file当前操作的文件对象。
jsx
   {
      uid: 'uid',      // 文件唯一标识,建议设置为负数,防止和内部产生的 id 冲突
      name: 'xx.png',   // 文件名
      status: 'done', // 状态有:uploading done error removed
      response: '{"status": "success"}', // 服务端响应内容
      linkProps: '{"download": "image"}', // 下载链接额外的 HTML 属性
      xhr: 'XMLHttpRequest{ ... }', // XMLHttpRequest Header
   }- fileList当前的文件列表。
- event上传中的服务端响应内容,包含了上传进度等信息,高级浏览器支持。


