Skip to content

Commit

Permalink
Popper: fix not destory in keep-alive when inject global mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
caiyuancheng committed Oct 20, 2021
1 parent 5390f40 commit 375c8cf
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/utils/vue-popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

0 comments on commit 375c8cf

Please sign in to comment.