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

pull/5469/head
bqy_fe 3 years ago committed by GitHub
parent e82e4bed3e
commit c9eb20f24b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

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

Loading…
Cancel
Save