--- 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. ```tsx import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, Form, Input, Space } from 'antd'; import React from 'react'; const App: React.FC = () => { const onFinish = (values: any) => { console.log('Received values of form:', values); }; return (
{(fields, { add, remove }) => ( <> {fields.map(({ key, name, ...restField }) => ( remove(name)} /> ))} )}
); }; export default App; ```