import { Form } from '@ant-design/compatible'; import '@ant-design/compatible/assets/index.css'; import { Input, Modal } from 'antd'; import { FormComponentProps } from '@ant-design/compatible/es/form'; import React from 'react'; const FormItem = Form.Item; interface CreateFormProps extends FormComponentProps { modalVisible: boolean; onSubmit: (fieldsValue: { desc: string }) => void; onCancel: () => void; } const CreateForm: React.FC = props => { const { modalVisible, form, onSubmit: handleAdd, onCancel } = props; const okHandle = () => { form.validateFields((err, fieldsValue) => { if (err) return; form.resetFields(); handleAdd(fieldsValue); }); }; return ( onCancel()} > {form.getFieldDecorator('desc', { rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }], })()} ); }; export default Form.create()(CreateForm);