mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] Dialog: add getContainer option (#3040)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user