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
a和b的校验都相互依赖,这里用shouldUpdate去做,结果shouldUpdate执行了,对应的validator没有执行。这种应该怎么处理? <Form.Item noStyle shouldUpdate={(pre: any, current: any) => { const result = JSON.stringify(pre.a) !== JSON.stringify(current.a) || JSON.stringify(pre.b) !== JSON.stringify(current.b); console.log('shouldUpdate', result); return result; }} > { () => ( <Form.Item name="a" label="a方式" required rules={[ ({ getFieldValue }) => ({ validator(_, value) { // 依赖b console.log('validate); }, })]}> <Radio.Group disabled={disabled}> <Radio value={'ddd'}>ddd <Radio value={'xxx'}>xxx </Radio.Group> </Form.Item> ) } </Form.Item>
The text was updated successfully, but these errors were encountered:
为什么不直接用denpends不是更简单吗?
Sorry, something went wrong.
No branches or pull requests
a和b的校验都相互依赖,这里用shouldUpdate去做,结果shouldUpdate执行了,对应的validator没有执行。这种应该怎么处理?
<Form.Item
noStyle
shouldUpdate={(pre: any, current: any) => {
const result = JSON.stringify(pre.a) !== JSON.stringify(current.a)
|| JSON.stringify(pre.b) !== JSON.stringify(current.b);
console.log('shouldUpdate', result);
return result;
}}
>
{
() => (
<Form.Item name="a" label="a方式" required rules={[
({ getFieldValue }) => ({
validator(_, value) {
// 依赖b
console.log('validate);
},
})]}>
<Radio.Group disabled={disabled}>
<Radio value={'ddd'}>ddd
<Radio value={'xxx'}>xxx
</Radio.Group>
</Form.Item>
)
}
</Form.Item>
The text was updated successfully, but these errors were encountered: