Skip to content

Commit 64a4d8f

Browse files
committed
feat(Upload): enhance capture type
1 parent 6dc7e21 commit 64a4d8f

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/upload/type.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ export interface TdUploadProps<T extends UploadFile = UploadFile> {
4444
beforeUpload?: (file: UploadFile) => boolean | Promise<boolean>;
4545
/**
4646
* 图片选取模式,可选值为 camera (直接调起摄像头)
47-
* @default ''
4847
*/
49-
capture?: string;
48+
capture?: string | boolean;
5049
/**
5150
* 非拖拽场景,指触发上传的元素,如:“选择文件”。如果是拖拽场景,则是指拖拽区域
5251
*/

src/upload/upload.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ addContent | TNode | - | Typescript: `string \| TNode`。[see more ts definition
1515
allowUploadDuplicateFile | Boolean | false | allow to upload duplicate name files | N
1616
autoUpload | Boolean | true | post upload request automatically after files being selected | N
1717
beforeUpload | Function | - | stop one of files to upload。Typescript: `(file: UploadFile) => boolean \| Promise<boolean>` | N
18-
capture | String | - | \- | N
18+
capture | String / Boolean | - | \- | N
1919
children | TNode | - | to define upload trigger elements if `draggable=false`, to define drag elements if `draggable=true`。Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2020
data | Object | - | extra request data of uploading. `formatRequest` can redefine all request data。Typescript: `Record<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | N
2121
disabled | Boolean | undefined | make upload to be disabled | N

src/upload/upload.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ addContent | TNode | - | 添加按钮内容。值为空,使用默认图标渲
1515
allowUploadDuplicateFile | Boolean | false | 是否允许重复上传相同文件名的文件。在 `capture = ''` + 拍照上传场景中,`allowUploadDuplicateFile` 应取 `true`,避免拍照上传的文件被同名文件校验过滤 | N
1616
autoUpload | Boolean | true | 是否在选择文件后自动发起请求上传文件 | N
1717
beforeUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示单个文件上传之前的钩子函数,若函数返回值为 `false` 则表示不上传当前文件。<br/>如果是非自动上传模式 `autoUpload=false`,函数返回值为 `false` 时表示从上传文件中剔除当前文件。TS 类型:`(file: UploadFile) => boolean \| Promise<boolean>` | N
18-
capture | String | - | 图片选取模式,可选值为 camera (直接调起摄像头) | N
18+
capture | String / Boolean | - | 图片选取模式,可选值为 camera (直接调起摄像头) | N
1919
children | TNode | - | 非拖拽场景,指触发上传的元素,如:“选择文件”。如果是拖拽场景,则是指拖拽区域。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2020
data | Object | - | 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}``autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段。TS 类型:`Record<string, any> \| ((files: UploadFile[]) => Record<string, any>)` | N
2121
disabled | Boolean | undefined | 是否禁用组件 | N

0 commit comments

Comments
 (0)