Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dropdownmenu): value typescript support array #1166

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>;
Loading