提交 6d5f9aa6 作者: 无木

feat(modal): add closeModal for useModal

上级 21f7a854
...@@ -90,6 +90,10 @@ export function useModal(): UseModalReturnType { ...@@ -90,6 +90,10 @@ export function useModal(): UseModalReturnType {
dataTransferRef[unref(uidRef)] = toRaw(data); dataTransferRef[unref(uidRef)] = toRaw(data);
} }
}, },
closeModal: () => {
getInstance()?.setModalProps({ visible: false });
},
}; };
return [register, methods]; return [register, methods];
} }
......
...@@ -13,6 +13,7 @@ export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void; ...@@ -13,6 +13,7 @@ export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void;
export interface ReturnMethods extends ModalMethods { export interface ReturnMethods extends ModalMethods {
openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void; openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void;
closeModal: () => void;
getVisible?: ComputedRef<boolean>; getVisible?: ComputedRef<boolean>;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论