Skip to content

Commit c9eb20f

Browse files
authored
docs(dropdown): make type definitions more beautiful (#5460)
1 parent e82e4be commit c9eb20f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

components/dropdown/index.zh-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
2727
| overlay(v-slot) | 菜单 | [Menu](/components/menu-cn) | - | |
2828
| overlayClassName | 下拉根元素的类名称 | string | - | |
2929
| overlayStyle | 下拉根元素的样式 | object | - | |
30-
| placement | 菜单弹出位置`bottomLeft` `bottom` `bottomRight` `topLeft` `top` `topRight` | String | `bottomLeft` | |
30+
| placement | 菜单弹出位置 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` | |
3131
| trigger | 触发下拉的行为, 移动端不支持 hover | Array<`click`\|`hover`\|`contextmenu`> | `['hover']` | |
3232
| visible(v-model) | 菜单是否显示 | boolean | - | |
3333

@@ -51,7 +51,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
5151
| icon | 右侧的 icon | VNode \| slot | - | 1.5.0 |
5252
| loading | 设置按钮载入状态 | boolean \| { delay: number } | false | 3.0 |
5353
| overlay(v-slot) | 菜单 | [Menu](/components/menu-cn/) | - | |
54-
| placement | 菜单弹出位置`bottomLeft` `bottom` `bottomRight` `topLeft` `top` `topRight` | String | `bottomLeft` | |
54+
| placement | 菜单弹出位置 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` | |
5555
| size | 按钮大小,和 [Button](/components/button-cn/) 一致 | string | 'default' | |
5656
| trigger | 触发下拉的行为 | Array<`click`\|`hover`\|`contextmenu`> | `['hover']` | |
5757
| type | 按钮类型,和 [Button](/components/button-cn/) 一致 | string | 'default' | |

components/dropdown/props.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PropTypes from '../_util/vue-types';
44
import buttonTypes from '../button/buttonTypes';
55
import type { MouseEventHandler } from '../_util/EventInterface';
66

7-
type Align = {
7+
export type Align = {
88
points?: [string, string];
99
offset?: [number, number];
1010
targetOffset?: [number, number];
@@ -17,6 +17,8 @@ type Align = {
1717
useCssTransform?: boolean;
1818
};
1919

20+
export type Trigger = 'click' | 'hover' | 'contextmenu';
21+
2022
export type DropdownArrowOptions = {
2123
pointAtCenter?: boolean;
2224
};
@@ -26,9 +28,7 @@ const dropdownProps = () => ({
2628
default: undefined,
2729
},
2830
trigger: {
29-
type: [Array, String] as PropType<
30-
('click' | 'hover' | 'contextmenu')[] | 'click' | 'hover' | 'contextmenu'
31-
>,
31+
type: [Array, String] as PropType<Trigger[] | Trigger>,
3232
},
3333
overlay: PropTypes.any,
3434
visible: { type: Boolean, default: undefined },

0 commit comments

Comments
 (0)