Skip to content

Commit

Permalink
feat(modal): add closeModal for useModal
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetfan committed Jun 8, 2021
1 parent 21f7a85 commit 6d5f9aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/Modal/src/hooks/useModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export function useModal(): UseModalReturnType {
dataTransferRef[unref(uidRef)] = toRaw(data);
}
},

closeModal: () => {
getInstance()?.setModalProps({ visible: false });
},
};
return [register, methods];
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void;

export interface ReturnMethods extends ModalMethods {
openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void;
closeModal: () => void;
getVisible?: ComputedRef<boolean>;
}

Expand Down

0 comments on commit 6d5f9aa

Please sign in to comment.