mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:31:41 +08:00
perf: enhance openModal and openDrawer
This commit is contained in:
@@ -7,7 +7,7 @@ export interface DrawerInstance {
|
||||
}
|
||||
|
||||
export interface ReturnMethods extends DrawerInstance {
|
||||
openDrawer: (visible?: boolean) => void;
|
||||
openDrawer: <T = any>(visible?: boolean, data?: T) => void;
|
||||
transferDrawerData: (data: any) => void;
|
||||
}
|
||||
|
||||
|
@@ -51,10 +51,13 @@ export function useDrawer(): UseDrawerReturnType {
|
||||
getInstance().setDrawerProps(props);
|
||||
},
|
||||
|
||||
openDrawer: (visible = true): void => {
|
||||
openDrawer: <T = any>(visible = true, data?: T): void => {
|
||||
getInstance().setDrawerProps({
|
||||
visible: visible,
|
||||
});
|
||||
if (data) {
|
||||
dataTransferRef[unref(uidRef)] = data;
|
||||
}
|
||||
},
|
||||
|
||||
transferDrawerData(val: any) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { ButtonProps } from 'ant-design-vue/types/button/button';
|
||||
import type { ButtonProps } from 'ant-design-vue/lib/button/buttonTypes';
|
||||
import type { CSSProperties, VNodeChild } from 'vue';
|
||||
/**
|
||||
* @description: 弹窗对外暴露的方法
|
||||
@@ -9,7 +9,7 @@ export interface ModalMethods {
|
||||
|
||||
export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void;
|
||||
export interface ReturnMethods extends ModalMethods {
|
||||
openModal: (props?: boolean) => void;
|
||||
openModal: <T = any>(props?: boolean, data?: T) => void;
|
||||
transferModalData: (data: any) => void;
|
||||
}
|
||||
export type UseModalReturnType = [RegisterFn, ReturnMethods];
|
||||
|
@@ -46,10 +46,13 @@ export function useModal(): UseModalReturnType {
|
||||
getInstance().setModalProps(props);
|
||||
},
|
||||
|
||||
openModal: (visible = true): void => {
|
||||
openModal: <T = any>(visible = true, data?: T): void => {
|
||||
getInstance().setModalProps({
|
||||
visible: visible,
|
||||
});
|
||||
if (data) {
|
||||
dataTransferRef[unref(uidRef)] = data;
|
||||
}
|
||||
},
|
||||
|
||||
transferModalData(val: any) {
|
||||
|
Reference in New Issue
Block a user