2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 4
|
|
|
|
title: 输入框组合
|
|
|
|
---
|
2015-10-29 08:41:51 +08:00
|
|
|
|
2015-11-06 14:13:26 +08:00
|
|
|
各类输入框的组合展现。
|
|
|
|
|
2015-10-29 08:41:51 +08:00
|
|
|
````jsx
|
2016-05-18 11:41:57 +08:00
|
|
|
import { Form, Input, Select, Col } from 'antd';
|
2015-10-29 08:41:51 +08:00
|
|
|
const FormItem = Form.Item;
|
|
|
|
const InputGroup = Input.Group;
|
|
|
|
const Option = Select.Option;
|
|
|
|
|
2016-06-16 21:15:59 +08:00
|
|
|
const selectAfter = (<Select defaultValue=".com" style={{ width: 70 }}>
|
|
|
|
<Option value=".com">.com</Option>
|
|
|
|
<Option value=".jp">.jp</Option>
|
|
|
|
<Option value=".cn">.cn</Option>
|
|
|
|
<Option value=".org">.org</Option>
|
|
|
|
</Select>);
|
|
|
|
|
2015-10-29 08:41:51 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<Form horizontal>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="标签输入框"
|
2016-01-27 16:44:50 +08:00
|
|
|
labelCol={{ span: 6 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 16 }}
|
|
|
|
>
|
2016-02-22 10:52:30 +08:00
|
|
|
<Input addonBefore="Http://" defaultValue="mysite.com" id="site1" />
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="标签输入框"
|
2016-01-27 16:44:50 +08:00
|
|
|
labelCol={{ span: 6 }}
|
2016-05-24 20:08:13 +08:00
|
|
|
validateStatus="success"
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 16 }}
|
|
|
|
>
|
2016-02-22 10:52:30 +08:00
|
|
|
<Input addonBefore="Http://" addonAfter=".com" defaultValue="mysite" id="site2" />
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="select 标签输入框"
|
2016-01-27 16:44:50 +08:00
|
|
|
labelCol={{ span: 6 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 16 }}
|
|
|
|
>
|
2016-06-16 21:15:59 +08:00
|
|
|
<Input addonAfter={selectAfter} placeholder="www.mysite" id="site4" />
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="输入身份证"
|
2016-01-27 16:44:50 +08:00
|
|
|
labelCol={{ span: 6 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 16 }}
|
|
|
|
>
|
2015-10-29 08:41:51 +08:00
|
|
|
<InputGroup>
|
|
|
|
<Col span="6">
|
|
|
|
<Input id="certNo1" />
|
|
|
|
</Col>
|
|
|
|
<Col span="6">
|
|
|
|
<Input id="certNo2" />
|
|
|
|
</Col>
|
|
|
|
<Col span="6">
|
|
|
|
<Input id="certNo3" />
|
|
|
|
</Col>
|
|
|
|
<Col span="6">
|
|
|
|
<Input id="certNo4" />
|
|
|
|
</Col>
|
|
|
|
</InputGroup>
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="电话号码"
|
2016-01-27 16:44:50 +08:00
|
|
|
labelCol={{ span: 6 }}
|
2016-06-06 13:54:10 +08:00
|
|
|
wrapperCol={{ span: 16 }}
|
|
|
|
>
|
2016-05-18 11:41:57 +08:00
|
|
|
<InputGroup>
|
2015-10-29 08:41:51 +08:00
|
|
|
<Col span="4">
|
2015-11-04 17:10:19 +08:00
|
|
|
<Input id="tel1" defaultValue="086" />
|
2015-10-29 08:41:51 +08:00
|
|
|
</Col>
|
|
|
|
<Col span="2">
|
|
|
|
<p className="ant-form-split">--</p>
|
|
|
|
</Col>
|
2016-05-18 11:41:57 +08:00
|
|
|
<Col span="6">
|
|
|
|
<Input id="tel1" />
|
|
|
|
</Col>
|
|
|
|
<Col span="6">
|
|
|
|
<Input id="tel2" />
|
2015-10-29 08:41:51 +08:00
|
|
|
</Col>
|
2016-05-18 11:41:57 +08:00
|
|
|
<Col span="6">
|
|
|
|
<Input id="tel3" />
|
|
|
|
</Col>
|
|
|
|
</InputGroup>
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
</Form>
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-10-29 08:41:51 +08:00
|
|
|
````
|