Skip to content

Commit

Permalink
fix(dropdownmenu): value typescript support array (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoopZhou authored Dec 5, 2023
1 parent 4752730 commit 398f9d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/dropdown-menu/dropdown-item-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ export default {
},
/** 选中值 */
value: {
type: [String, Number] as PropType<TdDropdownItemProps['value']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['value']>,
default: undefined,
},
modelValue: {
type: [String, Number] as PropType<TdDropdownItemProps['value']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['value']>,
default: undefined,
},
/** 选中值,非受控属性 */
defaultValue: {
type: [String, Number] as PropType<TdDropdownItemProps['defaultValue']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['defaultValue']>,
default: undefined,
},
/** 值改变时触发 */
Expand Down
4 changes: 2 additions & 2 deletions src/dropdown-menu/dropdown-menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ label | String | - | \- | N
multiple | Boolean | false | \- | N
options | Array | [] | Typescript:`Array<DropdownOption>` `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<DropdownValue>;`[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<DropdownValue>;`[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`<br/> | N
onConfirm | Function | | Typescript:`(value: DropdownValue) => void`<br/> | N
onReset | Function | | Typescript:`(value: DropdownValue) => void`<br/> | N
Expand Down
4 changes: 2 additions & 2 deletions src/dropdown-menu/dropdown-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ label | String | - | 标题 | N
multiple | Boolean | false | 是否多选 | N
options | Array | [] | 选项数据。TS 类型:`Array<DropdownOption>` `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<DropdownValue>;`[详细类型定义](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<DropdownValue>;`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
onChange | Function | | TS 类型:`(value: DropdownValue) => void`<br/>值改变时触发 | N
onConfirm | Function | | TS 类型:`(value: DropdownValue) => void`<br/>点击确认时触发 | N
onReset | Function | | TS 类型:`(value: DropdownValue) => void`<br/>点击重置时触发 | N
Expand Down
2 changes: 1 addition & 1 deletion src/dropdown-menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ export interface DropdownOption {
value: DropdownValue;
}

export type DropdownValue = string | number;
export type DropdownValue = string | number | Array<DropdownValue>;

0 comments on commit 398f9d5

Please sign in to comment.