modal.js 1.7 KB

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