Skip to content

Commit

Permalink
fix(upload): the data attribute definition is missing Function type
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs committed Apr 19, 2024
1 parent 6e73a9d commit 81d4c06
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/upload/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
},
/** 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段 */
data: {
type: Object as PropType<TdUploadProps['data']>,
type: [Object, Function] as PropType<TdUploadProps['data']>,
},
/** 非拖拽场景,指触发上传的元素,如:“选择文件”。如果是拖拽场景,则是指拖拽区域 */
default: {
Expand Down
2 changes: 1 addition & 1 deletion src/upload/upload.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>` | N
beforeUpload | Function | - | stop one of files to upload。Typescript:`(file: UploadFile) => boolean \| Promise<boolean>` | 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<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | N
data | Object / Function | - | extra request data of uploading. `formatRequest` can redefine all request data。Typescript:`Record<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | 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<TriggerContext>`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion src/upload/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ autoUpload | Boolean | true | 是否在选择文件后自动发起请求上传
beforeAllFilesUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示全部文件上传之前的钩子函数,函数参数为上传的文件,函数返回值决定是否继续上传,若返回值为 `false` 则终止上传。<br/>如果是非自动上传模式 `autoUpload=false`,则函数返回值为 `false` 时表示本次选中的文件不会加入到文件列表中,即不触发 `onChange` 事件。TS 类型:`(file: UploadFile[]) => boolean \| Promise<boolean>` | N
beforeUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示单个文件上传之前的钩子函数,若函数返回值为 `false` 则表示不上传当前文件。<br/>如果是非自动上传模式 `autoUpload=false`,函数返回值为 `false` 时表示从上传文件中剔除当前文件。TS 类型:`(file: UploadFile) => boolean \| Promise<boolean>` | 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<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | N
data | Object / Function | - | 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}``autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段。TS 类型:`Record<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | 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<TriggerContext>`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
Expand Down

0 comments on commit 81d4c06

Please sign in to comment.