# 水平排列的表单 - order: 2 示例展示了如何通过使用 `Form.ValueMixin` 来获取和更新表单提交的数值。 **注意:** 你需要为每个输入控件声明 `name` 属性。 --- ````jsx import {Form, Input, Button, Checkbox, Radio, Row, Col, message} from 'antd'; const FormItem = Form.Item; const RadioGroup = Radio.Group; const Demo = React.createClass({ mixins: [Form.ValueMixin], getInitialState() { return { formData: { userName: '大眼萌 minion', password: undefined, gender: 'male', remark: undefined, agreement: undefined, } }; }, handleSubmit(e) { e.preventDefault(); message.success("收到表单值~~~ :" + JSON.stringify(this.state.formData, function(k, v) { if (typeof v === 'undefined') { return ''; } return v; })); }, render() { const formData = this.state.formData; return (
); } }); ReactDOM.render(