# 与 Modal 配合使用 - order: 14 在 Modal 中使用 Form,当点击 Modal 的确定时,调用 `this.props.form.getFieldsValue` 获取表单内的值。 --- ````jsx import { Button, Form, Input, Modal } from 'antd'; const createForm = Form.create; const FormItem = Form.Item; let Demo = React.createClass({ getInitialState() { return { visible: false }; }, handleSubmit() { console.log(this.props.form.getFieldsValue()); this.hideModal(); }, showModal() { this.setState({ visible: true }); }, hideModal() { this.setState({ visible: false }); }, render() { const { getFieldProps } = this.props.form; const formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 20 }, }; return (
); } }); Demo = createForm()(Demo); ReactDOM.render(, mountNode); ````