fix: 修复表单重置后,页面变化了,但是由于异步问题导致表单内部的状态没有及时同步 (#3882)

This commit is contained in:
Jun 2024-05-29 21:56:56 +08:00 committed by GitHub
parent c89417f523
commit 5d36b1a560
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,9 +78,13 @@ export function useForm(props?: Props): UseFormReturnType {
form.clearValidate(name);
},
resetFields: async () => {
getForm().then(async (form) => {
await form.resetFields();
resetFields: () => {
// 修复表单重置后,页面变化了,但是由于异步问题导致表单内部的状态没有及时同步
return new Promise((resolve) => {
getForm().then(async (form) => {
await form.resetFields();
resolve();
});
});
},