Commit 911ca687 authored by Gideon King's avatar Gideon King Committed by hetech

Popover: fix popover issues with hover display (#13104)

* Fix issue with popover displaying on focus when configuration is for it to show on hover.
Fix issue with popover timer still running when button clicked and parent element no longer visible (e.g. keepalive component).

* Updated to pass tests

* Correct documentation for el-date-picker

* Changes as per ziyoung review
parent 62cce0e9
...@@ -373,6 +373,8 @@ Pay attention to capitalization ...@@ -373,6 +373,8 @@ Pay attention to capitalization
| `yyyy` | year | | 2017 | | `yyyy` | year | | 2017 |
| `M` | month | no leading 0 | 1 | | `M` | month | no leading 0 | 1 |
| `MM` | month | | 01 | | `MM` | month | | 01 |
| `MMM` | month | | Jan |
| `MMMM` | month | | January |
| `W` | week | only for week picker's `format`; no leading 0 | 1 | | `W` | week | only for week picker's `format`; no leading 0 | 1 |
| `WW` | week | only for week picker's `format`| 01 | | `WW` | week | only for week picker's `format`| 01 |
| `d` | day | no leading 0 | 2 | | `d` | day | no leading 0 | 2 |
......
...@@ -123,6 +123,14 @@ export default { ...@@ -123,6 +123,14 @@ export default {
} }
}, },
beforeDestroy() {
this.cleanup();
},
deactivated() {
this.cleanup();
},
methods: { methods: {
doToggle() { doToggle() {
this.showPopper = !this.showPopper; this.showPopper = !this.showPopper;
...@@ -135,14 +143,14 @@ export default { ...@@ -135,14 +143,14 @@ export default {
}, },
handleFocus() { handleFocus() {
addClass(this.referenceElm, 'focusing'); addClass(this.referenceElm, 'focusing');
if (this.trigger !== 'manual') this.showPopper = true; if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
}, },
handleClick() { handleClick() {
removeClass(this.referenceElm, 'focusing'); removeClass(this.referenceElm, 'focusing');
}, },
handleBlur() { handleBlur() {
removeClass(this.referenceElm, 'focusing'); removeClass(this.referenceElm, 'focusing');
if (this.trigger !== 'manual') this.showPopper = false; if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
}, },
handleMouseEnter() { handleMouseEnter() {
clearTimeout(this._timer); clearTimeout(this._timer);
...@@ -186,6 +194,11 @@ export default { ...@@ -186,6 +194,11 @@ export default {
handleAfterLeave() { handleAfterLeave() {
this.$emit('after-leave'); this.$emit('after-leave');
this.doDestroy(); this.doDestroy();
},
cleanup() {
if (this.openDelay) {
clearTimeout(this._timer);
}
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment