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