We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const [abnormalTypeOpts, setAbnormalTypeOpts] = useState([]) const { getFieldDecorator, validateFields, errors, values, setFieldsValue } = useForm({ onValuesChange: (values) => { if (values.orderType !== undefined) { setFieldsValue({ type: abnormalTypeOpts[0] // abnormalTypeOpts拿到的一直是[] }) } } }) useEffect(() => { setAbnormalTypeOpts([{name: '测试'}]) });
The text was updated successfully, but these errors were encountered:
感觉 useForm 需要第二个参数 deps
Sorry, something went wrong.
可以把onValuesChange里的逻辑放在useEffect里,然后依赖values
这种方式就没办法知道是哪个字段change了吧,我现在用ref缓存了 abnormalTypeOpts 值,倒是可以拿到。
No branches or pull requests
The text was updated successfully, but these errors were encountered: