const res = JSON.parse(e.data)
const h = this.$createElement
singleNotify({
title: '报警提示',
position: 'bottom-right',
offset: -15,
message: h(AlarmPrompt, {props: {alarmInfo: res}})
})
import AlarmPrompt from '@/components/AlarmPrompt'
AlarmPrompt 为显示的自定义内容组合
封装的js
import { Notification } from 'element-ui'
let messageInstance = null
const message = (options) => {
if (messageInstance) {
messageInstance.close()
}
messageInstance = Notification(options)
}
message.close = () => {
if (messageInstance) {
messageInstance.close()
}
}
export const singleNotify = message
