Dropdown: remove transition delay when trigger is click (#9573)

pull/9575/head
杨奕 2018-01-31 11:22:32 +08:00 committed by GitHub
parent 40e815f1aa
commit f274f3e3d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -328,8 +328,8 @@ Besides default size, Dropdown component provides three additional sizes for you
| placement | placement of pop menu | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end | | placement | placement of pop menu | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end |
| trigger | how to trigger | string | hover/click | hover | | trigger | how to trigger | string | hover/click | hover |
| hide-on-click | whether to hide menu after clicking menu-item | boolean | — | true | | hide-on-click | whether to hide menu after clicking menu-item | boolean | — | true |
| show-timeout | Delay time before show a dropdown | number | — | 250 | | show-timeout | Delay time before show a dropdown (only works when trigger is `hover`) | number | — | 250 |
| hide-timeout | Delay time before hide a dropdown | number | — | 150 | | hide-timeout | Delay time before hide a dropdown (only works when trigger is `hover`) | number | — | 150 |
### Dropdown Events ### Dropdown Events
| Event Name | Description | Parameters | | Event Name | Description | Parameters |

View File

@ -330,8 +330,8 @@ Además del tamaño predeterminado, el componente Dropdown proporciona tres tama
| placement | colocación del menú | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end | | placement | colocación del menú | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end |
| trigger | cómo detonar | string | hover/click | hover | | trigger | cómo detonar | string | hover/click | hover |
| hide-on-click | si se oculta el menú después de hacer clic en el elemento | boolean | — | true | | hide-on-click | si se oculta el menú después de hacer clic en el elemento | boolean | — | true |
| show-timeout | Tiempo de retardo antes de mostrar un dropdown | number | — | 250 | | show-timeout | Tiempo de retardo antes de mostrar un dropdown (only works when trigger is `hover`) | number | — | 250 |
| hide-timeout | Tiempo de retardo antes de ocultar un dropdown | number | — | 150 | | hide-timeout | Tiempo de retardo antes de ocultar un dropdown (only works when trigger is `hover`) | number | — | 150 |
### Dropdown Eventos ### Dropdown Eventos
| Nombre | Descripción | Parametros | | Nombre | Descripción | Parametros |

View File

@ -334,8 +334,8 @@ Dropdown 组件提供除了默认值以外的三种尺寸,可以在不同场
| placement | 菜单弹出位置 | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end | | placement | 菜单弹出位置 | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-end |
| trigger | 触发下拉的行为 | string | hover, click | hover | | trigger | 触发下拉的行为 | string | hover, click | hover |
| hide-on-click | 是否在点击菜单项后隐藏菜单 | boolean | — | true | | hide-on-click | 是否在点击菜单项后隐藏菜单 | boolean | — | true |
| show-timeout | 展开下拉菜单的延时 | number | — | 250 | | show-timeout | 展开下拉菜单的延时(仅在 trigger 为 hover 时有效)| number | — | 250 |
| hide-timeout | 收起下拉菜单的延时 | number | — | 150 | | hide-timeout | 收起下拉菜单的延时(仅在 trigger 为 hover 时有效)| number | — | 150 |
### Dropdown Events ### Dropdown Events
| 事件名称 | 说明 | 回调参数 | | 事件名称 | 说明 | 回调参数 |

View File

@ -115,7 +115,7 @@
clearTimeout(this.timeout); clearTimeout(this.timeout);
this.timeout = setTimeout(() => { this.timeout = setTimeout(() => {
this.visible = true; this.visible = true;
}, this.showTimeout); }, this.trigger === 'click' ? 0 : this.showTimeout);
}, },
hide() { hide() {
if (this.triggerElm.disabled) return; if (this.triggerElm.disabled) return;
@ -124,7 +124,7 @@
clearTimeout(this.timeout); clearTimeout(this.timeout);
this.timeout = setTimeout(() => { this.timeout = setTimeout(() => {
this.visible = false; this.visible = false;
}, this.hideTimeout); }, this.trigger === 'click' ? 0 : this.hideTimeout);
}, },
handleClick() { handleClick() {
if (this.triggerElm.disabled) return; if (this.triggerElm.disabled) return;