Open pointhalo opened 1 year ago
Form
v2.28.0
No response
class ArrayFieldSetValues extends React.Component { constructor() { super(); this.state = { data: { }, }; this.getFormApi = this.getFormApi.bind(this); } componentDidMount() { this.formApi.setValues({ effects: [ { name: "脸部贴纸", type: "2D" }, { name: "前景贴纸", type: "3D" }, ], test: 'fff' }) } getFormApi(formApi) { this.formApi = formApi; } render() { return ( <Form // onChange={(...v) => console.log(v)} onValueChange={(...v) => console.log(v)} getFormApi={this.getFormApi}> <Row> <Col span={12}> <ArrayField field="effects"> {({ add, arrayFields }) => ( <React.Fragment> <Button onClick={add} type="primary">Add</Button> { arrayFields.map(({ field, key, remove }, i) => ( <div key={key}> <Input field={`${field}[name]`} label={`${field}.name`} // initValue='test' /> <Input field={`${field}[time]`} label={`${field}.time`} /> <Button type="danger" onClick={remove}>remove</Button> </div> )) } </React.Fragment> )} </ArrayField> <Form.Input field="test" label="Test" /> <Space> <Button htmlType='reset'>Reset</Button> </Space> </Col> <Col span={12}> <ComponentUsingFormState /> </Col> </Row> </Form> ); } }
- OS: - browser:
这个bug有能先workaround的方法吗?
Is there an existing issue for this?
Which Component
Form
Semi Version
v2.28.0
Current Behavior
Expected Behavior
Steps To Reproduce
No response
ReproducibleCode
Environment
Anything else?
No response