Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): allow collect from fieldsValue in props formInstance #9

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/FormRenderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@
### ref

通过 ref 可以拿到 FormRenderer 内部的 ant-design form 实例。

### form

如果传入了 form 实例,则 FormRenderer 内部不会再创建新的 form 实例,数据都将收集在传入的 form 中,也就无需再通过 ref 去访问表单数据了。注意:传入的 form 实例必须是在 `Form.useForm()` 中创建的,不要使用类组件中通过 ref 创建的实例。
3 changes: 2 additions & 1 deletion packages/core/src/components/formRenderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ const FormRenderer: React.ForwardRefRenderFunction<
header,
footer,
debounceSearch,
form: formInstance,
...restProps
} = props;
const [form] = useForm();
const [form] = useForm(formInstance);
const [extraDataRef, updateExtraData] = useExtraData({
serviceLoading: {},
});
Expand Down