在Antd的
下面是一个包含代码示例的解决方法:
import { Form, Input, Button } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
const MyForm = () => {
const onFinish = (values) => {
console.log('Received values of form:', values);
};
return (
{(fields, { add, remove }) => {
return (
{fields.map((field, index) => (
{fields.length > 1 ? (
remove(field.name)}
/>
) : null}
))}
);
}}
);
};
export default MyForm;
在上面的代码中,我们使用