From 69b917fa605be8ccd0984e5c095f24d6476dce95 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 05 六月 2026 00:55:46 +0800
Subject: [PATCH] 1
---
src/plugins/modal.js | 82 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/src/plugins/modal.js b/src/plugins/modal.js
new file mode 100644
index 0000000..8695360
--- /dev/null
+++ b/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()
+ }
+}
--
Gitblit v1.9.3