From 3a2ab7f3a7f89cd299df07126d74a2c6f3ce91f8 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 03 六月 2026 20:18:59 +0800
Subject: [PATCH] 提交:山西林昇焱工贸有限公司/山西羿神晟农生物科技发展有限公司 配置文件
---
src/hooks/useModal.js | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/src/hooks/useModal.js b/src/hooks/useModal.js
new file mode 100644
index 0000000..0d443a1
--- /dev/null
+++ b/src/hooks/useModal.js
@@ -0,0 +1,41 @@
+import { ref } from "vue";
+export function useModal(options) {
+ const id = ref();
+ const visible = ref(false);
+ const loading = ref(false);
+ const modalOptions = ref({});
+
+ const openModal = (e) => {
+ id.value = e;
+ modalOptions.value = {
+ title: e ? `淇敼${options.title}` : `鏂板${options.title}`,
+ content: "纭畾鎵ц姝ゆ搷浣滃悧锛�",
+ confirmText: "纭畾",
+ cancelText: "鍙栨秷",
+ };
+ visible.value = true;
+ };
+
+ // 鍏抽棴妯℃�佹
+ const closeModal = () => {
+ visible.value = false;
+ loading.value = false;
+ };
+
+ // 纭鎿嶄綔
+ const handleConfirm = async (callback) => {
+ loading.value = true;
+ callback();
+ closeModal();
+ };
+
+ return {
+ id,
+ visible,
+ loading,
+ modalOptions,
+ openModal,
+ closeModal,
+ handleConfirm,
+ };
+}
--
Gitblit v1.9.3