spring
刚刚 b5ce6e3f835a8d2a4e350aa3790579b167c88c97
src/plugins/modal.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus'
let loadingInstance
export default {
  // æ¶ˆæ¯æç¤º
  msg(content) {
    ElMessage.info(content)
  },
  // é”™è¯¯æ¶ˆæ¯
  msgError(content) {
    ElMessage.error(content)
  },
  // æˆåŠŸæ¶ˆæ¯
  msgSuccess(content) {
    ElMessage.success(content)
  },
  // è­¦å‘Šæ¶ˆæ¯
  msgWarning(content) {
    ElMessage.warning(content)
  },
  // å¼¹å‡ºæç¤º
  alert(content) {
    ElMessageBox.alert(content, "系统提示")
  },
  // é”™è¯¯æç¤º
  alertError(content) {
    ElMessageBox.alert(content, "系统提示", { type: 'error' })
  },
  // æˆåŠŸæç¤º
  alertSuccess(content) {
    ElMessageBox.alert(content, "系统提示", { type: 'success' })
  },
  // è­¦å‘Šæç¤º
  alertWarning(content) {
    ElMessageBox.alert(content, "系统提示", { type: 'warning' })
  },
  // é€šçŸ¥æç¤º
  notify(content) {
    ElNotification.info(content)
  },
  // é”™è¯¯é€šçŸ¥
  notifyError(content) {
    ElNotification.error(content)
  },
  // æˆåŠŸé€šçŸ¥
  notifySuccess(content) {
    ElNotification.success(content)
  },
  // è­¦å‘Šé€šçŸ¥
  notifyWarning(content) {
    ElNotification.warning(content)
  },
  // ç¡®è®¤çª—体
  confirm(content) {
    return ElMessageBox.confirm(content, "系统提示", {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: "warning",
    })
  },
  // æäº¤å†…容
  prompt(content) {
    return ElMessageBox.prompt(content, "系统提示", {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: "warning",
    })
  },
  // æ‰“开遮罩层
  loading(content) {
    loadingInstance = ElLoading.service({
      lock: true,
      text: content,
      background: "rgba(0, 0, 0, 0.7)",
    })
  },
  // å…³é—­é®ç½©å±‚
  closeLoading() {
    loadingInstance.close()
  }
}