From d53d02a4d7608478dc33b53ff36a9ede5c5156a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B0=8F=E7=8E=8B=E5=AD=90?= Date: Tue, 5 Mar 2024 17:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0useDialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useDialog.ts | 31 +++++++++++++++++++++++++++++++ src/types/env.d.ts | 1 + src/types/global.d.ts | 1 + 3 files changed, 33 insertions(+) create mode 100644 src/hooks/useDialog.ts diff --git a/src/hooks/useDialog.ts b/src/hooks/useDialog.ts new file mode 100644 index 0000000..547f199 --- /dev/null +++ b/src/hooks/useDialog.ts @@ -0,0 +1,31 @@ +import { Ref } from 'vue'; + +interface Options { + title?: string; +} +interface Return { + title: Ref; + visible: Ref; + openDialog: () => void; + closeDialog: () => void; +} +export default (ops?: Options): Return => { + const visible = ref(false); + const title = ref(ops.title || ''); + + const openDialog = () => { + visible.value = true; + }; + + const closeDialog = () => { + visible.value = false; + }; + + return { + title, + visible, + + openDialog, + closeDialog + }; +}; diff --git a/src/types/env.d.ts b/src/types/env.d.ts index 6667d05..5b18a8e 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -14,6 +14,7 @@ interface ImportMetaEnv { VITE_APP_MONITRO_ADMIN: string; VITE_APP_POWERJOB_ADMIN: string; VITE_APP_ENV: string; + VITE_APP_ENCRYPT: string VITE_APP_RSA_PUBLIC_KEY: string; VITE_APP_RSA_PRIVATE_KEY: string; VITE_APP_CLIENT_ID: string; diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 7c1cb3b..63edfbe 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -69,6 +69,7 @@ declare global { /** 乐观锁 */ version?: number; createBy?: any; + createDept?: any; createTime?: string; updateBy?: any; updateTime?: any;