Skip to content

Commit b290af6

Browse files
goldengeckoFeng
authored andcommitted
Popover: fix popover issues with hover display (ElemeFE#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
1 parent 3732d09 commit b290af6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

examples/docs/en-US/date-picker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ Pay attention to capitalization
373373
| `yyyy` | year | | 2017 |
374374
| `M` | month | no leading 0 | 1 |
375375
| `MM` | month | | 01 |
376+
| `MMM` | month | | Jan |
377+
| `MMMM` | month | | January |
376378
| `W` | week | only for week picker's `format`; no leading 0 | 1 |
377379
| `WW` | week | only for week picker's `format`| 01 |
378380
| `d` | day | no leading 0 | 2 |

packages/popover/src/main.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ export default {
123123
}
124124
},
125125
126+
beforeDestroy() {
127+
this.cleanup();
128+
},
129+
130+
deactivated() {
131+
this.cleanup();
132+
},
133+
126134
methods: {
127135
doToggle() {
128136
this.showPopper = !this.showPopper;
@@ -135,14 +143,14 @@ export default {
135143
},
136144
handleFocus() {
137145
addClass(this.referenceElm, 'focusing');
138-
if (this.trigger !== 'manual') this.showPopper = true;
146+
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
139147
},
140148
handleClick() {
141149
removeClass(this.referenceElm, 'focusing');
142150
},
143151
handleBlur() {
144152
removeClass(this.referenceElm, 'focusing');
145-
if (this.trigger !== 'manual') this.showPopper = false;
153+
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
146154
},
147155
handleMouseEnter() {
148156
clearTimeout(this._timer);
@@ -186,6 +194,11 @@ export default {
186194
handleAfterLeave() {
187195
this.$emit('after-leave');
188196
this.doDestroy();
197+
},
198+
cleanup() {
199+
if (this.openDelay) {
200+
clearTimeout(this._timer);
201+
}
189202
}
190203
},
191204

0 commit comments

Comments
 (0)