From 0cc507fbc5d7fceb44c0203ab9dd4dfb0eb1ce0d Mon Sep 17 00:00:00 2001 From: "HUOJIN\\92525" <925258474@qq.com> Date: Sat, 14 Sep 2024 17:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=80=9A=E7=9F=A5=EF=BC=8C?= =?UTF-8?q?=E6=9C=89=E6=B6=88=E6=81=AF=E6=97=B6=E8=87=AA=E5=8A=A8=E5=BC=B9?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; } } }