From 4c12943e3ca84a78f9e8871cdb005a4e787573fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 20 Jan 2025 11:18:10 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=81=A2=E5=A4=8D=E8=AF=AF=E5=88=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useDialog.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 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 + }; +};