瀏覽代碼

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

杨奕 7 年之前
父節點
當前提交
f274f3e3d9

+ 2 - 2
examples/docs/en-US/dropdown.md

@@ -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 |
 | trigger       | how to trigger     | string  |    hover/click  |  hover |
 | hide-on-click | whether to hide menu after clicking menu-item     | boolean          | — | true |
-| show-timeout | Delay time before show a dropdown     | number          | — | 250 |
-| hide-timeout | Delay time before hide a dropdown     | number          | — | 150 |
+| show-timeout | Delay time before show a dropdown (only works when trigger is `hover`) | number | — | 250 |
+| hide-timeout | Delay time before hide a dropdown (only works when trigger is `hover`) | number | — | 150 |
 
 ### Dropdown Events
 | Event Name | Description | Parameters |

+ 2 - 2
examples/docs/es/dropdown.md

@@ -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  |
 | 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        |
-| show-timeout  | Tiempo de retardo antes de mostrar un dropdown | number  | —                                        | 250         |
-| hide-timeout  | Tiempo de retardo antes de ocultar un dropdown | number  | —                                        | 150         |
+| 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 (only works when trigger is `hover`) | number  | —                                        | 150         |
 
 ### Dropdown Eventos
 | Nombre         | Descripción                              | Parametros                               |

+ 2 - 2
examples/docs/zh-CN/dropdown.md

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

+ 2 - 2
packages/dropdown/src/dropdown.vue

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