From 30bbb3229b26973cbde828ccfc4bcd6fef54b003 Mon Sep 17 00:00:00 2001 From: loopzhou <363415642@qq.com> Date: Mon, 27 Nov 2023 10:49:39 +0800 Subject: [PATCH] fix(dropdownmenu): value typescript support array --- src/dropdown-menu/dropdown-item-props.ts | 6 +++--- src/dropdown-menu/dropdown-menu.en-US.md | 4 ++-- src/dropdown-menu/dropdown-menu.md | 4 ++-- src/dropdown-menu/type.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dropdown-menu/dropdown-item-props.ts b/src/dropdown-menu/dropdown-item-props.ts index 6dfb57d1b..0c7b56938 100644 --- a/src/dropdown-menu/dropdown-item-props.ts +++ b/src/dropdown-menu/dropdown-item-props.ts @@ -33,16 +33,16 @@ export default { }, /** 选中值 */ value: { - type: [String, Number] as PropType, + type: [String, Number, Array] as PropType, default: undefined, }, modelValue: { - type: [String, Number] as PropType, + type: [String, Number, Array] as PropType, default: undefined, }, /** 选中值,非受控属性 */ defaultValue: { - type: [String, Number] as PropType, + type: [String, Number, Array] as PropType, default: undefined, }, /** 值改变时触发 */ diff --git a/src/dropdown-menu/dropdown-menu.en-US.md b/src/dropdown-menu/dropdown-menu.en-US.md index b720a88d7..9af08b1ee 100644 --- a/src/dropdown-menu/dropdown-menu.en-US.md +++ b/src/dropdown-menu/dropdown-menu.en-US.md @@ -21,8 +21,8 @@ label | String | - | \- | N multiple | Boolean | false | \- | N options | Array | [] | Typescript:`Array` `interface DropdownOption { label: string; disabled: boolean; value: DropdownValue; }`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N optionsColumns | String / Number | 1 | \- | N -value | String / Number | undefined | `v-model` and `v-model:value` is supported。Typescript:`DropdownValue ` `type DropdownValue = string \| number;`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N -defaultValue | String / Number | undefined | uncontrolled property。Typescript:`DropdownValue ` `type DropdownValue = string \| number;`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N +value | String / Number / Array | undefined | `v-model` and `v-model:value` is supported。Typescript:`DropdownValue ` `type DropdownValue = string \| number \| Array;`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N +defaultValue | String / Number / Array | undefined | uncontrolled property。Typescript:`DropdownValue ` `type DropdownValue = string \| number \| Array;`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N onChange | Function | | Typescript:`(value: DropdownValue) => void`
| N onConfirm | Function | | Typescript:`(value: DropdownValue) => void`
| N onReset | Function | | Typescript:`(value: DropdownValue) => void`
| N diff --git a/src/dropdown-menu/dropdown-menu.md b/src/dropdown-menu/dropdown-menu.md index 934d05078..603b8798f 100644 --- a/src/dropdown-menu/dropdown-menu.md +++ b/src/dropdown-menu/dropdown-menu.md @@ -21,8 +21,8 @@ label | String | - | 标题 | N multiple | Boolean | false | 是否多选 | N options | Array | [] | 选项数据。TS 类型:`Array` `interface DropdownOption { label: string; disabled: boolean; value: DropdownValue; }`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N optionsColumns | String / Number | 1 | 选项分栏(1-3) | N -value | String / Number | undefined | 选中值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`DropdownValue ` `type DropdownValue = string \| number;`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N -defaultValue | String / Number | undefined | 选中值。非受控属性。TS 类型:`DropdownValue ` `type DropdownValue = string \| number;`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N +value | String / Number / Array | undefined | 选中值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`DropdownValue ` `type DropdownValue = string \| number \| Array;`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N +defaultValue | String / Number / Array | undefined | 选中值。非受控属性。TS 类型:`DropdownValue ` `type DropdownValue = string \| number \| Array;`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N onChange | Function | | TS 类型:`(value: DropdownValue) => void`
值改变时触发 | N onConfirm | Function | | TS 类型:`(value: DropdownValue) => void`
点击确认时触发 | N onReset | Function | | TS 类型:`(value: DropdownValue) => void`
点击重置时触发 | N diff --git a/src/dropdown-menu/type.ts b/src/dropdown-menu/type.ts index 792c4022b..79bfc03ef 100644 --- a/src/dropdown-menu/type.ts +++ b/src/dropdown-menu/type.ts @@ -96,4 +96,4 @@ export interface DropdownOption { value: DropdownValue; } -export type DropdownValue = string | number; +export type DropdownValue = string | number | Array;