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

使用onchange实时获取表单数据的时候不能set到state状态中,会导致表单数据不显示或者输入框无法输入内容 #1621

Open
pulingxing opened this issue Jan 22, 2025 · 0 comments
Assignees

Comments

@pulingxing
Copy link

期望使用onchange实时获取表单数据的时能setAllValues到useState状态中

const [allValues, setAllValues] = useState({});
const handleOnChange = () => {
const formData = formRender.getValues();
setAllValues(formData);
};
<FormRender
form={formRender}
readOnly={action === 'view' ? true : false}
className={style['question-container']}
autoComplete='off'
schema={schema}
onChange={handleOnChange}
maxWidth={360}
colon={true}
footer={false}
/>

现在react项目中需要通过Change事件获取到表单的值,并同步传给子组件使用,需要线用一个状态存一下实时获取的表单值,但是这样会导致formRender表单数据显示有问题,请问怎么处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants