导入:
import { Form, Input } from 'antd';
const { TextArea } = Input;
render:
const { getFieldDecorator } = this.props.form;
<Form layout="inline">
<Form.Item label="Username">
{getFieldDecorator('username', {
rules: [{ required: true, message: 'Username is required!' }],
})(<TextArea rows={4} />)}
</Form.Item>
<Form.Item wrapperCol={{ span: 12, offset: 5 }}>
<Button type="primary" htmlType="submit" onClick={() => { console.log(this.props.form.getFieldsValue()) }}>
Submit
</Button>
</Form.Item>
</Form>
暴露:
export default Form.create()(ModelInterface);
获取:
this.props.form.getFieldsValue()