增加useDialog

This commit is contained in:
数据小王子 2024-03-05 17:14:53 +08:00
parent 9e9773fa82
commit d53d02a4d7
3 changed files with 33 additions and 0 deletions

31
src/hooks/useDialog.ts Normal file
View File

@ -0,0 +1,31 @@
import { Ref } from 'vue';
interface Options {
title?: string;
}
interface Return {
title: Ref<string>;
visible: Ref<boolean>;
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
};
};

1
src/types/env.d.ts vendored
View File

@ -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;

View File

@ -69,6 +69,7 @@ declare global {
/** 乐观锁 */
version?: number;
createBy?: any;
createDept?: any;
createTime?: string;
updateBy?: any;
updateTime?: any;