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
<Form.List name="sights"> {(fields, { add, remove }) => ( <> {fields.map((field) => ( <Space key={field.key} align="baseline"> <Form.Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.area !== curValues.area || prevValues.sights !== curValues.sights } > {() => ( <Form.Item {...field} label="Sight" name={[field.name, "sight"]} rules={[ { required: true, message: "Missing sight" } ]} > <Select disabled={!form.getFieldValue("area")} style={{ width: 130 }} > {(sights[form.getFieldValue("area")] || []).map( (item) => ( <Option key={item} value={item}> {item} </Option> ) )} </Select> </Form.Item> )} </Form.Item> <Form.Item {...field} label="Price" name={[field.name, "price"]} rules={[ { required: true, message: "Missing price" } ]} > <Input /> </Form.Item> <MinusCircleOutlined onClick={() => remove(field.name)} /> </Space> ))} <Form.Item> <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />} > Add sights </Button> <Button onClick={resetFirstLine}>reset first line</Button> </Form.Item> </> )} </Form.List>
const resetFirstLine = () => { form.setFieldValue(["sights", 0], { sight: 1, price: 123 }); };
当触发 resetFirstLine 的时候页面上的listItem不刷新
codesandbox地址
The text was updated successfully, but these errors were encountered:
没看懂问题在哪,name='sights' 的第一个 Field 没刷新?
Sorry, something went wrong.
对的,
No branches or pull requests
JSX
调用JS
当触发 resetFirstLine 的时候页面上的listItem不刷新
codesandbox地址
The text was updated successfully, but these errors were encountered: