diff --git a/src/components/base/notification/index.js b/src/components/base/notification/index.js index 981c75b6..7ab2c625 100644 --- a/src/components/base/notification/index.js +++ b/src/components/base/notification/index.js @@ -29,7 +29,10 @@ Notification.newInstance = properties => { }, component: notification, destroy () { - document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement); + notification.closeAll(); + setTimeout(function() { + document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement); + }, 500); } }; }; diff --git a/src/components/base/notification/notification.vue b/src/components/base/notification/notification.vue index 5409079a..9695b55e 100644 --- a/src/components/base/notification/notification.vue +++ b/src/components/base/notification/notification.vue @@ -81,13 +81,15 @@ }, close (name) { const notices = this.notices; - for (let i = 0; i < notices.length; i++) { if (notices[i].name === name) { this.notices.splice(i, 1); break; } } + }, + closeAll () { + this.notices = []; } } };