import { Message, MessageBox, Notification, Loading } from 'element-ui'
let loadingInstance;
export default {
// æ¶ˆæ¯æç¤º
msg(content) {
Message.info(content)
},
// 错误消æ¯
msgError(content) {
Message.error(content)
},
// æˆåŠŸæ¶ˆæ¯
msgSuccess(content) {
Message.success(content)
},
// è¦å‘Šæ¶ˆæ¯
msgWarning(content) {
Message.warning(content)
},
// 弹出æç¤º
alert(content) {
MessageBox.alert(content, "系统æç¤º")
},
// 错误æç¤º
alertError(content) {
MessageBox.alert(content, "系统æç¤º", { type: 'error' })
},
// æˆåŠŸæç¤º
alertSuccess(content) {
MessageBox.alert(content, "系统æç¤º", { type: 'success' })
},
// è¦å‘Šæç¤º
alertWarning(content) {
MessageBox.alert(content, "系统æç¤º", { type: 'warning' })
},
// 通知æç¤º
notify(content) {
Notification.info(content)
},
// 错误通知
notifyError(content) {
Notification.error(content);
},
// æˆåŠŸé€šçŸ¥
notifySuccess(content) {
Notification.success(content)
},
// è¦å‘Šé€šçŸ¥
notifyWarning(content) {
Notification.warning(content)
},
// 确认窗体
confirm(content) {
return MessageBox.confirm(content, "系统æç¤º", {
confirmButtonText: '确定',
cancelButtonText: 'å–æ¶ˆ',
type: "warning",
})
},
// 打开é®ç½©å±‚
loading(content) {
loadingInstance = Loading.service({
lock: true,
text: content,
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
})
},
// å…³é—é®ç½©å±‚
closeLoading() {
loadingInstance.close();
}
}