--- order: 99 title: zh-CN: 提交修改前看看这个对不对 en-US: Please check this before commit debug: true --- ## zh-CN 提交修改前看看这个对不对。 ## en-US Please check this before commit. ```jsx import { Button, Modal, Form, Row, Col, Input, Select, InputNumber, Radio, DatePicker } from 'antd'; const ColSpan = { lg: 12, md: 24 }; class App extends React.Component { constructor() { super(); this.state = { visible: false, }; } handleClick = () => { this.setState({ visible: true, }); }; handleCancel = () => { this.setState({ visible: false, }); }; handleSubmit = e => { e.preventDefault(); const { form } = this.props; form.validateFields((error, values) => { console.log(error, values); }); }; render() { const { form: { getFieldDecorator }, } = this.props; const { Item } = Form; const itemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 }, }; const span = 12; return (
{/* Case 1: Form in modal */}
{getFieldDecorator('item1', { rules: [{ required: true, message: '请必须填写此字段' }], })()} {getFieldDecorator('item2', { rules: [{ required: true, message: '请必须填写此字段' }], })()} {getFieldDecorator('item3')()} {getFieldDecorator('item4', { rules: [{ required: true, message: '请必须填写此字段' }], })()} {getFieldDecorator('item5', { rules: [{ required: true, message: '请必须填写此字段' }], })()} {getFieldDecorator('item6', { rules: [{ required: true, message: '请必须填写此字段' }], })()}
{/* case 2: Form different item */}