[new feature] Dialog: add getContainer option (#3040)

This commit is contained in:
neverland
2019-03-22 15:13:30 +08:00
committed by GitHub
parent 5a44d204bd
commit c1adaebaa6
9 changed files with 25 additions and 22 deletions

View File

@@ -32,7 +32,6 @@ function createInstance() {
const toast = new (Vue.extend(VueToast))({
el: document.createElement('div')
});
document.body.appendChild(toast.$el);
queue.push(toast);
}
return queue[queue.length - 1];
@@ -60,7 +59,10 @@ function Toast(options = {}) {
if (!singleton && !isServer) {
clearTimeout(toast.timer);
queue = queue.filter(item => item !== toast);
document.body.removeChild(toast.$el);
if (document.body.contains(toast.$el)) {
document.body.removeChild(toast.$el);
}
toast.$destroy();
}
}