Newer
Older
DH_Apicture / src / plugins / modal.js
@ZZJ ZZJ on 30 Nov 2 KB 融云样式相关
  1. import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus';
  2.  
  3. let loadingInstance;
  4.  
  5. export default {
  6. // 消息提示
  7. msg(content) {
  8. ElMessage.info({
  9. message: content,
  10. customClass: 'message-zindex',
  11. });
  12. },
  13. // 错误消息
  14. msgError(content) {
  15. ElMessage.error({
  16. message: content,
  17. customClass: 'message-zindex',
  18. });
  19. },
  20. // 成功消息
  21. msgSuccess(content) {
  22. ElMessage.success({
  23. message: content,
  24. customClass: 'message-zindex',
  25. });
  26. },
  27. // 警告消息
  28. msgWarning(content) {
  29. ElMessage.warning({
  30. message: content,
  31. customClass: 'message-zindex',
  32. });
  33. },
  34. // 弹出提示
  35. alert(content) {
  36. ElMessageBox.alert(content, '系统提示');
  37. },
  38. // 错误提示
  39. alertError(content) {
  40. ElMessageBox.alert(content, '系统提示', { type: 'error' });
  41. },
  42. // 成功提示
  43. alertSuccess(content) {
  44. ElMessageBox.alert(content, '系统提示', { type: 'success' });
  45. },
  46. // 警告提示
  47. alertWarning(content) {
  48. ElMessageBox.alert(content, '系统提示', { type: 'warning' });
  49. },
  50. // 通知提示
  51. notify(content) {
  52. ElNotification.info(content);
  53. },
  54. // 错误通知
  55. notifyError(content) {
  56. ElNotification.error(content);
  57. },
  58. // 成功通知
  59. notifySuccess(content) {
  60. ElNotification.success(content);
  61. },
  62. // 警告通知
  63. notifyWarning(content) {
  64. ElNotification.warning(content);
  65. },
  66. // 确认窗体
  67. confirm(content, confirmButtonText, cancelButtonText) {
  68. return ElMessageBox.confirm(content, '系统提示', {
  69. confirmButtonText: confirmButtonText || '确定',
  70. cancelButtonText: cancelButtonText || '取消',
  71. type: 'warning',
  72. });
  73. },
  74. // 提交内容
  75. prompt(content) {
  76. return ElMessageBox.prompt(content, '系统提示', {
  77. confirmButtonText: '确定',
  78. cancelButtonText: '取消',
  79. type: 'warning',
  80. });
  81. },
  82. // 打开遮罩层
  83. loading(content) {
  84. loadingInstance = ElLoading.service({
  85. lock: true,
  86. text: content,
  87. background: 'rgba(0, 0, 0, 0.7)',
  88. });
  89. },
  90. // 关闭遮罩层
  91. closeLoading() {
  92. loadingInstance.close();
  93. },
  94. };