--- order: 4.1 title: zh-CN: 动态增减嵌套字段 en-US: Dynamic Form nest Items --- ## zh-CN 嵌套表单字段需要对 `field` 进行拓展,将 `field.name` 应用于控制字段。 ## en-US Nest dynamic field need extends `field`. Pass `field.name` 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 }) => ( <> {fields.map(({ key, name, ...restField }) => ( remove(name)} /> ))} )}
); }; export default () => ; ```