feat: There is no way the idm and oa

This commit is contained in:
super_liu
2021-10-11 17:48:17 +08:00
parent 637b3e1bb4
commit 19089f562f
10 changed files with 506 additions and 313 deletions
+27
View File
@@ -0,0 +1,27 @@
import {Message} from 'element-ui'
// 私有属性,只在当前文件可用
const showMessage = Symbol('showMessage')
export default class domMessage {
success (options, single = true) {
this[showMessage]('success', options, single)
}
warning(options, single = true) {
this[showMessage]('warning', options, single)
}
info(options, single = true) {
this[showMessage]('info', options, single)
}
error(options, single = true) {
this[showMessage]('error', options, single)
}
[showMessage] (type, options, single) {
if (single) {
// 关键代码,判断当前页是否有el-message标签,如果没有则执行弹窗操作
if (document.getElementsByClassName('el-message').length === 0) {
Message[type](options)
}
} else {
Message[type](options)
}
}
}