mirror of https://github.com/ElemeFE/element
fix: fix event memory leak
parent
5d7374bf16
commit
a9918f276c
|
@ -113,18 +113,7 @@ export default {
|
||||||
this.$el.setAttribute('tabindex', this.tabindex);
|
this.$el.setAttribute('tabindex', this.tabindex);
|
||||||
on(this.referenceElm, 'mouseenter', this.show);
|
on(this.referenceElm, 'mouseenter', this.show);
|
||||||
on(this.referenceElm, 'mouseleave', this.hide);
|
on(this.referenceElm, 'mouseleave', this.hide);
|
||||||
on(this.referenceElm, 'focus', () => {
|
on(this.referenceElm, 'focus', this.handleFocus);
|
||||||
if (!this.$slots.default || !this.$slots.default.length) {
|
|
||||||
this.handleFocus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const instance = this.$slots.default[0].componentInstance;
|
|
||||||
if (instance && instance.focus) {
|
|
||||||
instance.focus();
|
|
||||||
} else {
|
|
||||||
this.handleFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
on(this.referenceElm, 'blur', this.handleBlur);
|
on(this.referenceElm, 'blur', this.handleBlur);
|
||||||
on(this.referenceElm, 'click', this.removeFocusing);
|
on(this.referenceElm, 'click', this.removeFocusing);
|
||||||
}
|
}
|
||||||
|
@ -157,8 +146,18 @@ export default {
|
||||||
this.debounceClose();
|
this.debounceClose();
|
||||||
},
|
},
|
||||||
handleFocus() {
|
handleFocus() {
|
||||||
this.focusing = true;
|
if (!this.$slots.default || !this.$slots.default.length) {
|
||||||
this.show();
|
this.focusing = true;
|
||||||
|
this.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const instance = this.$slots.default[0].componentInstance;
|
||||||
|
if (instance && instance.focus) {
|
||||||
|
instance.focus();
|
||||||
|
} else {
|
||||||
|
this.focusing = true;
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handleBlur() {
|
handleBlur() {
|
||||||
this.focusing = false;
|
this.focusing = false;
|
||||||
|
|
Loading…
Reference in New Issue