提交 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 is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册