From 5698e77c72b2d0919a1e3d9e3480f86e5176280b Mon Sep 17 00:00:00 2001 From: phongkt Date: Tue, 24 Oct 2017 16:20:03 +0700 Subject: [PATCH] Dropdown: allow change show/hide timeout by props (#7621) * Dropdown: Allow change show/hide timeout by props * Dropdown: Fixes for document mistake --- examples/docs/en-US/dropdown.md | 2 ++ packages/dropdown/src/dropdown.vue | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/docs/en-US/dropdown.md b/examples/docs/en-US/dropdown.md index bd9720bad..9309ab2ff 100644 --- a/examples/docs/en-US/dropdown.md +++ b/examples/docs/en-US/dropdown.md @@ -210,6 +210,8 @@ Clicking each dropdown item fires an event whose parameter is assigned by each i | menu-align | horizontal alignment | string | start/end | 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 | ### Dropdown Events | Event Name | Description | Parameters | diff --git a/packages/dropdown/src/dropdown.vue b/packages/dropdown/src/dropdown.vue index d4dabd021..642176919 100644 --- a/packages/dropdown/src/dropdown.vue +++ b/packages/dropdown/src/dropdown.vue @@ -33,6 +33,14 @@ hideOnClick: { type: Boolean, default: true + }, + showTimeout: { + type: Number, + default: 250 + }, + hideTimeout: { + type: Number, + default: 150 } }, @@ -62,14 +70,14 @@ clearTimeout(this.timeout); this.timeout = setTimeout(() => { this.visible = true; - }, 250); + }, this.showTimeout); }, hide() { if (this.triggerElm.disabled) return; clearTimeout(this.timeout); this.timeout = setTimeout(() => { this.visible = false; - }, 150); + }, this.hideTimeout); }, handleClick() { if (this.triggerElm.disabled) return;