From 8a1c08baaf0ee002b471996b195e7da180b90209 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期一, 21 七月 2025 09:38:47 +0800 Subject: [PATCH] 增加了前端代码库 --- src/plugins/modal.js | 83 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 deletions(-) diff --git a/src/plugins/modal.js b/src/plugins/modal.js new file mode 100644 index 0000000..92bc1ef --- /dev/null +++ b/src/plugins/modal.js @@ -0,0 +1,83 @@ +import { Message, MessageBox, Notification, Loading } from 'element-ui' + +let loadingInstance + +export default { + // 娑堟伅鎻愮ず + msg(content) { + Message.info(content) + }, + // 閿欒娑堟伅 + msgError(content) { + Message.error(content) + }, + // 鎴愬姛娑堟伅 + msgSuccess(content) { + Message.success(content) + }, + // 璀﹀憡娑堟伅 + msgWarning(content) { + Message.warning(content) + }, + // 寮瑰嚭鎻愮ず + alert(content) { + MessageBox.alert(content, "绯荤粺鎻愮ず") + }, + // 閿欒鎻愮ず + alertError(content) { + MessageBox.alert(content, "绯荤粺鎻愮ず", { type: 'error' }) + }, + // 鎴愬姛鎻愮ず + alertSuccess(content) { + MessageBox.alert(content, "绯荤粺鎻愮ず", { type: 'success' }) + }, + // 璀﹀憡鎻愮ず + alertWarning(content) { + MessageBox.alert(content, "绯荤粺鎻愮ず", { type: 'warning' }) + }, + // 閫氱煡鎻愮ず + notify(content) { + Notification.info(content) + }, + // 閿欒閫氱煡 + notifyError(content) { + Notification.error(content) + }, + // 鎴愬姛閫氱煡 + notifySuccess(content) { + Notification.success(content) + }, + // 璀﹀憡閫氱煡 + notifyWarning(content) { + Notification.warning(content) + }, + // 纭绐椾綋 + confirm(content) { + return MessageBox.confirm(content, "绯荤粺鎻愮ず", { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: "warning", + }) + }, + // 鎻愪氦鍐呭 + prompt(content) { + return MessageBox.prompt(content, "绯荤粺鎻愮ず", { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: "warning", + }) + }, + // 鎵撳紑閬僵灞� + loading(content) { + loadingInstance = Loading.service({ + lock: true, + text: content, + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }) + }, + // 鍏抽棴閬僵灞� + closeLoading() { + loadingInstance.close() + } +} -- Gitblit v1.9.1