docs(dropdown): make type definitions more beautiful (#5460)

This commit is contained in:
bqy_fe 2022-04-09 09:42:26 +08:00 committed by GitHub
parent e82e4bed3e
commit c9eb20f24b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
| overlay(v-slot) | 菜单 | [Menu](/components/menu-cn) | - | |
| overlayClassName | 下拉根元素的类名称 | string | - | |
| overlayStyle | 下拉根元素的样式 | object | - | |
| placement | 菜单弹出位置`bottomLeft` `bottom` `bottomRight` `topLeft` `top` `topRight` | String | `bottomLeft` | |
| placement | 菜单弹出位置 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` | |
| trigger | 触发下拉的行为, 移动端不支持 hover | Array<`click`\|`hover`\|`contextmenu`> | `['hover']` | |
| visible(v-model) | 菜单是否显示 | boolean | - | |
@ -51,7 +51,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
| icon | 右侧的 icon | VNode \| slot | - | 1.5.0 |
| loading | 设置按钮载入状态 | boolean \| { delay: number } | false | 3.0 |
| overlay(v-slot) | 菜单 | [Menu](/components/menu-cn/) | - | |
| placement | 菜单弹出位置`bottomLeft` `bottom` `bottomRight` `topLeft` `top` `topRight` | String | `bottomLeft` | |
| placement | 菜单弹出位置 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` | |
| size | 按钮大小,和 [Button](/components/button-cn/) 一致 | string | 'default' | |
| trigger | 触发下拉的行为 | Array<`click`\|`hover`\|`contextmenu`> | `['hover']` | |
| type | 按钮类型,和 [Button](/components/button-cn/) 一致 | string | 'default' | |

View File

@ -4,7 +4,7 @@ import PropTypes from '../_util/vue-types';
import buttonTypes from '../button/buttonTypes';
import type { MouseEventHandler } from '../_util/EventInterface';
type Align = {
export type Align = {
points?: [string, string];
offset?: [number, number];
targetOffset?: [number, number];
@ -17,6 +17,8 @@ type Align = {
useCssTransform?: boolean;
};
export type Trigger = 'click' | 'hover' | 'contextmenu';
export type DropdownArrowOptions = {
pointAtCenter?: boolean;
};
@ -26,9 +28,7 @@ const dropdownProps = () => ({
default: undefined,
},
trigger: {
type: [Array, String] as PropType<
('click' | 'hover' | 'contextmenu')[] | 'click' | 'hover' | 'contextmenu'
>,
type: [Array, String] as PropType<Trigger[] | Trigger>,
},
overlay: PropTypes.any,
visible: { type: Boolean, default: undefined },