mirror of https://github.com/ElemeFE/element
Popper: fix not destory in keep-alive when inject global mixins
parent
5390f4069e
commit
375c8cfc20
|
@ -180,19 +180,22 @@ export default {
|
||||||
arrow.setAttribute('x-arrow', '');
|
arrow.setAttribute('x-arrow', '');
|
||||||
arrow.className = 'popper__arrow';
|
arrow.className = 'popper__arrow';
|
||||||
element.appendChild(arrow);
|
element.appendChild(arrow);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
handleDestory() {
|
||||||
beforeDestroy() {
|
|
||||||
this.doDestroy(true);
|
this.doDestroy(true);
|
||||||
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
||||||
this.popperElm.removeEventListener('click', stop);
|
this.popperElm.removeEventListener('click', stop);
|
||||||
document.body.removeChild(this.popperElm);
|
document.body.removeChild(this.popperElm);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.handleDestory();
|
||||||
},
|
},
|
||||||
|
|
||||||
// call destroy in keep-alive mode
|
// call destroy in keep-alive mode
|
||||||
deactivated() {
|
deactivated() {
|
||||||
this.$options.beforeDestroy[0].call(this);
|
this.handleDestory();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue