diff --git a/src/views/home.vue b/src/views/home.vue index e749165..ccc1444 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -51,7 +51,8 @@ export default { async pollMsg() { //3秒轮询一次 this.pollingTimer = setInterval(async () => { - const data = {msg:'友仓智慧物流,软件定义物流。',msgType:'INFO'} + const data = {msg: '友仓智慧物流,软件定义物流。', msgType: 'INFO'} + console.log(data) this.createOrUpdateNotification(data) }, 3000); }, @@ -114,8 +115,13 @@ export default { message: data.msg, type: 'success', offset: 100, - duration: 0 + duration: 0, + onClose: this.onNotificationClose // 关闭时调用的方 }); + }, + onNotificationClose() { + this.showNotification = false; + this.notificationInstance = null; } }, beforeDestroy() { @@ -126,7 +132,10 @@ export default { this.websock.close(); } if (this.notificationInstance) { + console.log(111) this.notificationInstance.close(); // 关闭通知 + this.showNotification = false; + this.notificationInstance = null; } } }