feat(DropdownItem): supports boolean value in options (#12208)

This commit is contained in:
BaboonKing 2023-08-20 16:14:20 +08:00 committed by GitHub
parent 4b52766eb6
commit 95ae2de992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -146,7 +146,7 @@ export default defineComponent({
<Cell <Cell
v-slots={{ value: renderIcon }} v-slots={{ value: renderIcon }}
role="menuitem" role="menuitem"
key={option.value} key={String(option.value)}
icon={option.icon} icon={option.icon}
title={option.text} title={option.text}
class={bem('option', { active })} class={bem('option', { active })}

View File

@ -2,10 +2,12 @@ import type { DropdownItemProps } from './DropdownItem';
import type { VNode, ComponentPublicInstance } from 'vue'; import type { VNode, ComponentPublicInstance } from 'vue';
import type { Numeric } from '../utils'; import type { Numeric } from '../utils';
export type DropdownItemOptionValue = Numeric | boolean;
export type DropdownItemOption = { export type DropdownItemOption = {
text: string; text: string;
icon?: string; icon?: string;
value: Numeric; value: DropdownItemOptionValue;
}; };
export type DropdownItemExpose = { export type DropdownItemExpose = {

View File

@ -248,11 +248,11 @@ dropdownItemRef.value?.toggle();
### Data Structure of Option ### Data Structure of Option
| Key | Description | Type | | Key | Description | Type |
| ----- | ----------- | ------------------ | | ----- | ----------- | ----------------------------- |
| text | Text | _string_ | | text | Text | _string_ |
| value | Value | _number \| string_ | | value | Value | _number \| string \| boolean_ |
| icon | Left icon | _string_ | | icon | Left icon | _string_ |
## Theming ## Theming

View File

@ -255,7 +255,7 @@ dropdownItemRef.value?.toggle();
| 键名 | 说明 | 类型 | | 键名 | 说明 | 类型 |
| --- | --- | --- | | --- | --- | --- |
| text | 文字 | _string_ | | text | 文字 | _string_ |
| value | 标识符 | _number \| string_ | | value | 标识符 | _number \| string \| boolean_ |
| icon | 左侧图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | | icon | 左侧图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ |
## 主题定制 ## 主题定制