fix(Popup): may throw error when using get-container and destroyed

This commit is contained in:
陈嘉涵
2020-02-04 14:28:10 +08:00
parent 14ddf449a5
commit 52aa9e8559
3 changed files with 20 additions and 10 deletions
+11 -5
View File
@@ -1,10 +1,16 @@
// Context
import { context } from './context';
import { openOverlay, closeOverlay, updateOverlay } from './overlay';
// Utils
import { on, off, preventDefault } from '../../utils/dom/event';
import { removeNode } from '../../utils/dom/node';
import { getScroller } from '../../utils/dom/scroll';
// Mixins
import { TouchMixin } from '../touch';
import { PortalMixin } from '../portal';
import { CloseOnPopstateMixin } from '../close-on-popstate';
import { on, off, preventDefault } from '../../utils/dom/event';
import { openOverlay, closeOverlay, updateOverlay } from './overlay';
import { getScroller } from '../../utils/dom/scroll';
export const popupMixinProps = {
// whether to show popup
@@ -90,8 +96,8 @@ export function PopupMixin(options = {}) {
beforeDestroy() {
this.close();
if (this.getContainer && this.$parent && this.$parent.$el) {
this.$parent.$el.appendChild(this.$el);
if (this.getContainer) {
removeNode(this.$el);
}
},