关闭通知,有消息时自动弹通知
parent
e5ec6bc20f
commit
0cc507fbc5
|
|
@ -52,6 +52,7 @@ export default {
|
|||
//3秒轮询一次
|
||||
this.pollingTimer = setInterval(async () => {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue