Skip to content

Commit

Permalink
feat: the hideModelHandler method removed from the successful callback (
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaoei committed Sep 13, 2022
1 parent 361a6d1 commit 739d2a4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/modalWithForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export interface ModalProps {
footer?: string | React.ReactNode;
centered?: boolean;
cancelButtonProps?: ButtonProps;
notSubmitCloseModal?: boolean;
layout?: 'horizontal' | 'vertical' | 'inline';
children?: React.ReactElement;
[key: string]: any;
Expand All @@ -27,6 +26,7 @@ const ModalForm = (props: ModalProps) => {
const {
title,
visible,
record,
okText = '确定',
cancelText = '取消',
modelClass,
Expand All @@ -36,17 +36,16 @@ const ModalForm = (props: ModalProps) => {
cancelButtonProps,
layout = 'vertical',
hideModelHandler,
onSubmit,
children,
} = props;

const [form] = Form.useForm();

const okHandler = async () => {
const { record, notSubmitCloseModal = false, onSubmit, hideModelHandler } = props;
try {
const values = await form.validateFields();
onSubmit(values, record);
!notSubmitCloseModal && hideModelHandler();
} catch (error) {}
};

Expand Down

0 comments on commit 739d2a4

Please sign in to comment.