import React from 'react'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, Form, Input, Select, Space } from 'antd'; const { Option } = Select; const areas = [ { label: 'Beijing', value: 'Beijing' }, { label: 'Shanghai', value: 'Shanghai' }, ]; const sights = { Beijing: ['Tiananmen', 'Great Wall'], Shanghai: ['Oriental Pearl', 'The Bund'], }; type SightsKeys = keyof typeof sights; const App: React.FC = () => { const [form] = Form.useForm(); const onFinish = (values: any) => { console.log('Received values of form:', values); }; const handleChange = () => { form.setFieldsValue({ sights: [] }); }; return (
{(sights[form.getFieldValue('area') as SightsKeys] || []).map((item) => ( ))} )} remove(field.name)} /> ))} )} ); }; export default App;