From 81d4c06da70aee2b94e3027621ec0b36613da796 Mon Sep 17 00:00:00 2001 From: betavs Date: Fri, 19 Apr 2024 14:12:00 +0800 Subject: [PATCH] fix(upload): the data attribute definition is missing Function type --- src/upload/props.ts | 2 +- src/upload/upload.en-US.md | 2 +- src/upload/upload.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/upload/props.ts b/src/upload/props.ts index f28acfaac3..99aee1ab4b 100644 --- a/src/upload/props.ts +++ b/src/upload/props.ts @@ -43,7 +43,7 @@ export default { }, /** 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段 */ data: { - type: Object as PropType, + type: [Object, Function] as PropType, }, /** 非拖拽场景,指触发上传的元素,如:“选择文件”。如果是拖拽场景,则是指拖拽区域 */ default: { diff --git a/src/upload/upload.en-US.md b/src/upload/upload.en-US.md index f2d9bd9814..1fb64226ec 100644 --- a/src/upload/upload.en-US.md +++ b/src/upload/upload.en-US.md @@ -13,7 +13,7 @@ autoUpload | Boolean | true | post upload request automatically after files bein beforeAllFilesUpload | Function | - | before all files upload, return false can stop uploading file。Typescript:`(file: UploadFile[]) => boolean \| Promise` | N beforeUpload | Function | - | stop one of files to upload。Typescript:`(file: UploadFile) => boolean \| Promise` | N cancelUploadButton | Object / Slot / Function | - | cancel upload button props, which showed on `autoUpload=false` and multiple files/images upload。Typescript:`null \| ButtonProps \| TNode<{ disabled: boolean; cancelUploadText: string; cancelUpload: (ctx: { e: MouseEvent }) => void }>`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N -data | Object | - | extra request data of uploading. `formatRequest` can redefine all request data。Typescript:`Record \| ((files: UploadFile[]) => Record)` | N +data | Object / Function | - | extra request data of uploading. `formatRequest` can redefine all request data。Typescript:`Record \| ((files: UploadFile[]) => Record)` | N default | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N disabled | Boolean | - | make upload to be disabled | N dragContent | String / Slot / Function | - | define drag content nodes, it works on `theme=custom`。Typescript:`TNode \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N diff --git a/src/upload/upload.md b/src/upload/upload.md index a381b61a8c..b3e8674ca6 100644 --- a/src/upload/upload.md +++ b/src/upload/upload.md @@ -13,7 +13,7 @@ autoUpload | Boolean | true | 是否在选择文件后自动发起请求上传 beforeAllFilesUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示全部文件上传之前的钩子函数,函数参数为上传的文件,函数返回值决定是否继续上传,若返回值为 `false` 则终止上传。
如果是非自动上传模式 `autoUpload=false`,则函数返回值为 `false` 时表示本次选中的文件不会加入到文件列表中,即不触发 `onChange` 事件。TS 类型:`(file: UploadFile[]) => boolean \| Promise` | N beforeUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示单个文件上传之前的钩子函数,若函数返回值为 `false` 则表示不上传当前文件。
如果是非自动上传模式 `autoUpload=false`,函数返回值为 `false` 时表示从上传文件中剔除当前文件。TS 类型:`(file: UploadFile) => boolean \| Promise` | N cancelUploadButton | Object / Slot / Function | - | 批量文件/图片上传,`autoUpload=false` 场景下,透传“取消上传”按钮属性。TS 类型:`null \| ButtonProps \| TNode<{ disabled: boolean; cancelUploadText: string; cancelUpload: (ctx: { e: MouseEvent }) => void }>`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N -data | Object | - | 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段。TS 类型:`Record \| ((files: UploadFile[]) => Record)` | N +data | Object / Function | - | 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段。TS 类型:`Record \| ((files: UploadFile[]) => Record)` | N default | String / Slot / Function | - | 非拖拽场景,指触发上传的元素,如:“选择文件”。如果是拖拽场景,则是指拖拽区域。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N disabled | Boolean | - | 是否禁用 | N dragContent | String / Slot / Function | - | 用于自定义拖拽区域,`theme=custom` 且 `draggable=true` 时有效。TS 类型:`TNode \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N