修复弹出数据不重置

This commit is contained in:
hanhh
2021-06-27 00:19:48 +08:00
parent 9f5c8fa70a
commit 0a6c7e3719
5 changed files with 25 additions and 28 deletions
+8 -8
View File
@@ -36,12 +36,8 @@ const CronModal = ({
};
useEffect(() => {
if (cron) {
form.setFieldsValue(cron);
} else {
form.resetFields();
}
}, [cron]);
form.resetFields();
}, [cron, visible]);
return (
<Modal
@@ -60,9 +56,13 @@ const CronModal = ({
}}
onCancel={() => handleCancel()}
confirmLoading={loading}
destroyOnClose
>
<Form form={form} layout="vertical" name="form_in_modal" preserve={false}>
<Form
form={form}
layout="vertical"
name="form_in_modal"
initialValues={cron}
>
<Form.Item name="name" label="名称">
<Input placeholder="请输入任务名称" />
</Form.Item>