懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 import { Message, MessageBox, Notification, Loading } from 'element-ui'
2
3 let loadingInstance;
4
5 export default {
6   // 消息提示
7   msg(content) {
8     Message.info(content)
9   },
10   // 错误消息
11   msgError(content) {
12     Message.error(content)
13   },
14   // 成功消息
15   msgSuccess(content) {
16     Message.success(content)
17   },
18   // 警告消息
19   msgWarning(content) {
20     Message.warning(content)
21   },
22   // 弹出提示
23   alert(content) {
24     MessageBox.alert(content, "系统提示")
25   },
26   // 错误提示
27   alertError(content) {
28     MessageBox.alert(content, "系统提示", { type: 'error' })
29   },
30   // 成功提示
31   alertSuccess(content) {
32     MessageBox.alert(content, "系统提示", { type: 'success' })
33   },
34   // 警告提示
35   alertWarning(content) {
36     MessageBox.alert(content, "系统提示", { type: 'warning' })
37   },
38   // 通知提示
39   notify(content) {
40     Notification.info(content)
41   },
42   // 错误通知
43   notifyError(content) {
44     Notification.error(content);
45   },
46   // 成功通知
47   notifySuccess(content) {
48     Notification.success(content)
49   },
50   // 警告通知
51   notifyWarning(content) {
52     Notification.warning(content)
53   },
54   // 确认窗体
55   confirm(content) {
56     return MessageBox.confirm(content, "系统提示", {
57       confirmButtonText: '确定',
58       cancelButtonText: '取消',
59       type: "warning",
60     })
61   },
62   // 提交内容
63   prompt(content) {
64     return MessageBox.prompt(content, "系统提示", {
65       confirmButtonText: '确定',
66       cancelButtonText: '取消',
67       type: "warning",
68     })
69   },
70   // 打开遮罩层
71   loading(content) {
72     loadingInstance = Loading.service({
73       lock: true,
74       text: content,
75       spinner: "el-icon-loading",
76       background: "rgba(0, 0, 0, 0.7)",
77     })
78   },
79   // 关闭遮罩层
80   closeLoading() {
81     loadingInstance.close();
82   }
83 }