--- order: 4.1 title: zh-CN: 动态增减嵌套字段 en-US: Dynamic Form nest Items --- ## zh-CN 嵌套表单字段需要对 `field` 进行拓展,将 `field.name` 和 `field.fieldKey` 应用于控制字段。 ## en-US Nest dynamic field need extends `field`. Pass `field.name` and `field.fieldKey` to nest item. ```jsx import { Form, Input, Button, Space } from 'antd'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; const Demo = () => { const onFinish = values => { console.log('Received values of form:', values); }; return (
{(fields, { add, remove }) => { return (
{fields.map(field => ( { remove(field.name); }} /> ))}
); }}
); }; ReactDOM.render(, mountNode); ```