增加useDialog
This commit is contained in:
parent
9e9773fa82
commit
d53d02a4d7
31
src/hooks/useDialog.ts
Normal file
31
src/hooks/useDialog.ts
Normal 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
1
src/types/env.d.ts
vendored
@ -14,6 +14,7 @@ interface ImportMetaEnv {
|
|||||||
VITE_APP_MONITRO_ADMIN: string;
|
VITE_APP_MONITRO_ADMIN: string;
|
||||||
VITE_APP_POWERJOB_ADMIN: string;
|
VITE_APP_POWERJOB_ADMIN: string;
|
||||||
VITE_APP_ENV: string;
|
VITE_APP_ENV: string;
|
||||||
|
VITE_APP_ENCRYPT: string
|
||||||
VITE_APP_RSA_PUBLIC_KEY: string;
|
VITE_APP_RSA_PUBLIC_KEY: string;
|
||||||
VITE_APP_RSA_PRIVATE_KEY: string;
|
VITE_APP_RSA_PRIVATE_KEY: string;
|
||||||
VITE_APP_CLIENT_ID: string;
|
VITE_APP_CLIENT_ID: string;
|
||||||
|
1
src/types/global.d.ts
vendored
1
src/types/global.d.ts
vendored
@ -69,6 +69,7 @@ declare global {
|
|||||||
/** 乐观锁 */
|
/** 乐观锁 */
|
||||||
version?: number;
|
version?: number;
|
||||||
createBy?: any;
|
createBy?: any;
|
||||||
|
createDept?: any;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
updateBy?: any;
|
updateBy?: any;
|
||||||
updateTime?: any;
|
updateTime?: any;
|
||||||
|
Loading…
Reference in New Issue
Block a user