for (let i = 0; i < showList.length; i++) {
let notify = await this.$notify({//解决消息框重叠 也可以通过加延迟解决
title: showList[i].message.title,
message: h('p', [
h('p', null, showList[i].message.content),
h('p', {
class: 'notice-cursor',
on: {
click: () => {
this.closeNotification(showList[i].messageId)
},
},
}, '跳转列表查看'),
]),
dangerouslyUseHTMLString: true,
duration: 10000,
position: 'bottom-right',
customClass: 'home-notice',
offset: 20,
onClose() {
console.log('关闭回调')
}
})
this.notifications[showList[i].messageId] = notify
}
//关闭单个通知
closeNotification(messageId){
//省略部分代码
this.notifications[messageId].close()
delete this.notifications[messageId]
},
//关闭所有通知
closeAllNotification() {
for (let key in this.notifications) {
this.notifications[key].close()
delete this.notifications[key]
}
},