From c4233c199d310c1ffd21068c643de30152baa973 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Tue, 19 Nov 2024 16:40:40 +0800 Subject: [PATCH] feat(Upload): add capture props --- db/TDesign.db | Bin 1003520 -> 1003520 bytes .../tdesign-mobile-vue/src/upload/props.ts | 5 +++ .../tdesign-mobile-vue/src/upload/type.ts | 5 +++ .../src/upload/upload.en-US.md | 1 + .../tdesign-mobile-vue/src/upload/upload.md | 1 + packages/scripts/api.json | 39 ++++++++++++++++++ 6 files changed, 51 insertions(+) diff --git a/db/TDesign.db b/db/TDesign.db index b912cf045017be5bfbf5e72de6b40f2f3cbccc72..f52f7ea1dca3bf7d5f89139110fbd223350c6aed 100644 GIT binary patch delta 281 zcmZozVB4_3c7imc$wV1vRucxjvaZII))dCp6sFb`=GGLJ))dy(6t>nB_N^%#3*woD zn1ZLXCvYe;F$HfoOkh@Ls&5pUD=EdoD9I_!$;;cw%fP{FY|OyGz{$bO0pz6Hczu=# zEy&4FOi4~GC@C#UeL8#J^Un5{4V_Q>r#)M-@adlZ_j`Jt_OAztH0*h@W0yj5Vs2_t zqJqZr*;}6VEq$?}`Nh`l&nC7!ZSH@%WQ(Sefsu)>p`os!rGkNlm65oym7yt`7)Yr7 zWfBJva{@6J5OV`D&-Rx|ywZOe&9<{9@Z~Zw@p5c0N#e`qWYpRIAe&EzkqzWnzM0#F Ja{1mp0stk;X4?P& delta 124 zcmZozVB4_3c7imc@kAMCR$~UevW~`-))dCp6sFb`=GGLJ))dy(6t>nB_N^%#3*wmt znO;t3PvB7At|-91pQ-(25(f}-0x=g5a|1EY_LoV#(tjCEx3ebj+e_ XG~50ln@@*vdQ3Ji*LJa7zE_U`I=m{P diff --git a/packages/products/tdesign-mobile-vue/src/upload/props.ts b/packages/products/tdesign-mobile-vue/src/upload/props.ts index 6c69f84c..4eface34 100644 --- a/packages/products/tdesign-mobile-vue/src/upload/props.ts +++ b/packages/products/tdesign-mobile-vue/src/upload/props.ts @@ -33,6 +33,11 @@ export default { beforeUpload: { type: Function as PropType, }, + /** 图片选取模式,可选值为 camera (直接调起摄像头) */ + capture: { + type: String, + default: '', + }, /** 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段 */ data: { type: Object as PropType, diff --git a/packages/products/tdesign-mobile-vue/src/upload/type.ts b/packages/products/tdesign-mobile-vue/src/upload/type.ts index ea23d553..2d58c957 100644 --- a/packages/products/tdesign-mobile-vue/src/upload/type.ts +++ b/packages/products/tdesign-mobile-vue/src/upload/type.ts @@ -36,6 +36,11 @@ export interface TdUploadProps { * 如果是自动上传模式 `autoUpload=true`,表示单个文件上传之前的钩子函数,若函数返回值为 `false` 则表示不上传当前文件。
如果是非自动上传模式 `autoUpload=false`,函数返回值为 `false` 时表示从上传文件中剔除当前文件 */ beforeUpload?: (file: UploadFile) => boolean | Promise; + /** + * 图片选取模式,可选值为 camera (直接调起摄像头) + * @default '' + */ + capture?: string; /** * 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段 */ diff --git a/packages/products/tdesign-mobile-vue/src/upload/upload.en-US.md b/packages/products/tdesign-mobile-vue/src/upload/upload.en-US.md index c816725f..41a3668f 100644 --- a/packages/products/tdesign-mobile-vue/src/upload/upload.en-US.md +++ b/packages/products/tdesign-mobile-vue/src/upload/upload.en-US.md @@ -12,6 +12,7 @@ addContent | String / Slot / Function | - | Typescript:`string \| TNode`。[se allowUploadDuplicateFile | Boolean | false | allow to upload duplicate name files | N autoUpload | Boolean | true | post upload request automatically after files being selected | N beforeUpload | Function | - | stop one of files to upload。Typescript:`(file: UploadFile) => boolean \| Promise` | N +capture | String | - | \- | N data | Object | - | extra request data of uploading. `formatRequest` can redefine all request data。Typescript:`Record \| ((files: UploadFile[]) => Record)` | N disabled | Boolean | undefined | make upload to be disabled | N files | Array | [] | `v-model:files` is supported。Typescript:`Array` | N diff --git a/packages/products/tdesign-mobile-vue/src/upload/upload.md b/packages/products/tdesign-mobile-vue/src/upload/upload.md index 69500cb9..428081e8 100644 --- a/packages/products/tdesign-mobile-vue/src/upload/upload.md +++ b/packages/products/tdesign-mobile-vue/src/upload/upload.md @@ -12,6 +12,7 @@ addContent | String / Slot / Function | - | 添加按钮内容。值为空,使 allowUploadDuplicateFile | Boolean | false | 是否允许重复上传相同文件名的文件 | N autoUpload | Boolean | true | 是否在选择文件后自动发起请求上传文件 | N beforeUpload | Function | - | 如果是自动上传模式 `autoUpload=true`,表示单个文件上传之前的钩子函数,若函数返回值为 `false` 则表示不上传当前文件。
如果是非自动上传模式 `autoUpload=false`,函数返回值为 `false` 时表示从上传文件中剔除当前文件。TS 类型:`(file: UploadFile) => boolean \| Promise` | N +capture | String | - | 图片选取模式,可选值为 camera (直接调起摄像头) | N data | Object | - | 上传请求所需的额外字段,默认字段有 `file`,表示文件信息。可以添加额外的文件名字段,如:`{file_name: "custom-file-name.txt"}`。`autoUpload=true` 时有效。也可以使用 `formatRequest` 完全自定义上传请求的字段。TS 类型:`Record \| ((files: UploadFile[]) => Record)` | N disabled | Boolean | undefined | 是否禁用组件 | N files | Array | [] | 已上传文件列表,同 `value`。TS 类型:`UploadFile`。支持语法糖 `v-model:files`。TS 类型:`Array` | N diff --git a/packages/scripts/api.json b/packages/scripts/api.json index c4342fdb..3907ad93 100644 --- a/packages/scripts/api.json +++ b/packages/scripts/api.json @@ -135340,6 +135340,45 @@ "TNode" ] }, + { + "id": 1732004595, + "platform_framework": [ + "8", + "16" + ], + "component": "Upload", + "field_category": 1, + "field_name": "capture", + "field_type": [ + "1" + ], + "field_default_value": "", + "field_enum": "", + "field_desc_zh": "图片选取模式,可选值为 camera (直接调起摄像头)", + "field_desc_en": null, + "field_required": 0, + "event_input": "", + "create_time": "2024-11-19 08:23:15", + "update_time": "2024-11-19 08:23:15", + "event_output": null, + "custom_field_type": null, + "syntactic_sugar": null, + "readonly": 1, + "html_attribute": 0, + "trigger_elements": "", + "deprecated": 0, + "version": "", + "test_description": null, + "support_default_value": 0, + "field_category_text": "Props", + "platform_framework_text": [ + "Vue(Mobile)", + "React(Mobile)" + ], + "field_type_text": [ + "String" + ] + }, { "id": 1169, "platform_framework": [