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
Field
function App() { const field = Field.useField({ autoUnmount: false }); const [visible, setVisible] = useState(true); return ( <div className="App"> {JSON.stringify(field.getNames())} <Button onClick={() => { setVisible(!visible); }} > 切换item显示 </Button> <Form field={field}> {visible && ( <Form.Item label="文本" name="text" required> <Input /> </Form.Item> )} </Form> </div> ); }
https://codesandbox.io/s/fusion-next-template-forked-bgp5vc?file=/src/index.js:209-220
未设置autoUnmount前,如果我把visible设置为false,那么field.getNames就没有了text
但是设置autoUnmount后,无论我怎么切换visible,field.getNames()里就一定有text
我的场景是
现在的表现就导致,明明用户不需要输入这个内容,并且前端也没有渲染这个输入框。
但是校验的时候过不去,说用户未填写,因为getNames的时候仍然也有这个key
The text was updated successfully, but these errors were encountered:
你这个required根据visible去控制吧 因为autoUnmount为false 会保留自动卸载的组件数据。
Sorry, something went wrong.
YunMeng99
Successfully merging a pull request may close this issue.
Component
Field
Feature Description
https://codesandbox.io/s/fusion-next-template-forked-bgp5vc?file=/src/index.js:209-220
未设置autoUnmount前,如果我把visible设置为false,那么field.getNames就没有了text
但是设置autoUnmount后,无论我怎么切换visible,field.getNames()里就一定有text
我的场景是
现在的表现就导致,明明用户不需要输入这个内容,并且前端也没有渲染这个输入框。
但是校验的时候过不去,说用户未填写,因为getNames的时候仍然也有这个key
The text was updated successfully, but these errors were encountered: