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
+2 -5
View File
@@ -1,6 +1,7 @@
import Vue from 'vue';
import VueToast from './Toast';
import { isObject, isServer } from '../utils';
import { removeNode } from '../utils/dom/node';
const defaultOptions = {
icon: '',
@@ -100,11 +101,7 @@ function Toast(options = {}) {
clearTimeout(toast.timer);
queue = queue.filter(item => item !== toast);
const parent = toast.$el.parentNode;
if (parent) {
parent.removeChild(toast.$el);
}
removeNode(toast.$el);
toast.$destroy();
});
}