mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(DropdownItem): supports boolean value in options (#12208)
This commit is contained in:
parent
4b52766eb6
commit
95ae2de992
@ -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 })}
|
||||||
|
@ -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 = {
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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_ |
|
||||||
|
|
||||||
## 主题定制
|
## 主题定制
|
||||||
|
Loading…
x
Reference in New Issue
Block a user