Popper: fix not destory in keep-alive when inject global mixins

pull/21397/head
caiyuancheng 2021-10-20 10:43:15 +08:00
parent 5390f4069e
commit 375c8cfc20
1 changed files with 9 additions and 6 deletions

View File

@ -180,19 +180,22 @@ export default {
arrow.setAttribute('x-arrow', '');
arrow.className = 'popper__arrow';
element.appendChild(arrow);
},
handleDestory() {
this.doDestroy(true);
if (this.popperElm && this.popperElm.parentNode === document.body) {
this.popperElm.removeEventListener('click', stop);
document.body.removeChild(this.popperElm);
}
}
},
beforeDestroy() {
this.doDestroy(true);
if (this.popperElm && this.popperElm.parentNode === document.body) {
this.popperElm.removeEventListener('click', stop);
document.body.removeChild(this.popperElm);
}
this.handleDestory();
},
// call destroy in keep-alive mode
deactivated() {
this.$options.beforeDestroy[0].call(this);
this.handleDestory();
}
};