想做个修改操作,需要显示之前的表单值,但是不知道如何组织数据结构?
如图:
想要实现效果如下图,页面加载就默认有两个input框并且有两个值分别是1,2
代码
```import {
Form, Input, Icon, Button,} from 'antd';let id = 0;class DynamicFieldSet extends React.Component {
remove = (k) => {
const { form } = this.props;
// can use data-binding to get
const keys = form.getFieldValue('keys');
// We need at least one passenger
if (keys.length === 1) {
return;
}
// can use data-binding to set
form.setFieldsValue({
keys: keys.filter(key => key !== k),
});
}
add = () => {
const { form } = this.props;