--- order: 5 title: zh-CN: 表单组合 en-US: Mix --- ## zh-CN 集中营,展示和表单相关的其他 ant-design 组件。 ## en-US A mix to demonstrate others ant-design component related to form. ````jsx import { Form, Select, InputNumber, DatePicker, TimePicker, Switch, Radio, Cascader, Slider, Button, Col, Upload, Icon } from 'antd'; import moment from 'moment'; import 'moment/locale/zh-cn'; moment.locale('zh-cn'); const FormItem = Form.Item; const Option = Select.Option; const RadioButton = Radio.Button; const RadioGroup = Radio.Group; const areaData = [{ value: 'shanghai', label: 'Shanghai', children: [{ value: 'shanghaishi', label: 'Shanghai', children: [{ value: 'pudongxinqu', label: 'Pudong New District', }], }], }]; let Demo = React.createClass({ handleSubmit(e) { e.preventDefault(); console.log('Received the values of form', this.props.form.getFieldsValue()); }, normFile(e) { if (Array.isArray(e)) { return e; } return e && e.fileList; }, render() { const { getFieldDecorator } = this.props.form; return (
{getFieldDecorator('inputNumber', { initialValue: 3 })( )} machines

O, wind, if winter comes, can spring be far behind?

link

{getFieldDecorator('switch', { valuePropName: 'checked' })( )} {getFieldDecorator('slider')( )} {getFieldDecorator('select')( )} {getFieldDecorator('area')( )} {getFieldDecorator('startDate')( )}

-

{getFieldDecorator('endDate')( )}
{getFieldDecorator('time')( )} {getFieldDecorator('rg')( item 1 item 2 item 3 )} {getFieldDecorator('upload', { valuePropName: 'fileList', normalize: this.normFile, })( )}
); }, }); Demo = Form.create()(Demo); ReactDOM.render(, mountNode); ````