2016-05-25 18:21:27 +08:00
|
|
|
---
|
|
|
|
order: 3
|
2017-04-19 11:22:17 +08:00
|
|
|
title:
|
2016-08-22 10:27:43 +08:00
|
|
|
zh-CN: 输入框组合
|
2016-08-22 09:53:39 +08:00
|
|
|
en-US: Input Group
|
2016-05-25 18:21:27 +08:00
|
|
|
---
|
|
|
|
|
2016-08-22 09:53:39 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-06-16 21:15:59 +08:00
|
|
|
输入框的组合展现。
|
2016-05-25 18:21:27 +08:00
|
|
|
|
2017-01-02 00:12:41 +08:00
|
|
|
注意:使用 `compact` 模式时,不需要通过 `Col` 来控制宽度。
|
|
|
|
|
2016-08-22 09:53:39 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Input.Group example
|
|
|
|
|
2017-01-02 00:12:41 +08:00
|
|
|
Note: You don't need `Col` to control the width in the `compact` mode.
|
|
|
|
|
2017-02-13 10:55:53 +08:00
|
|
|
````jsx
|
2017-04-26 15:17:35 +08:00
|
|
|
import { Input, Col, Select, InputNumber, DatePicker, AutoComplete, Cascader } from 'antd';
|
2016-05-25 18:21:27 +08:00
|
|
|
const InputGroup = Input.Group;
|
2017-01-02 00:12:41 +08:00
|
|
|
const Option = Select.Option;
|
2016-05-25 18:21:27 +08:00
|
|
|
|
2017-04-26 15:17:35 +08:00
|
|
|
const options = [{
|
|
|
|
value: 'zhejiang',
|
|
|
|
label: 'Zhejiang',
|
|
|
|
children: [{
|
|
|
|
value: 'hangzhou',
|
|
|
|
label: 'Hangzhou',
|
|
|
|
children: [{
|
|
|
|
value: 'xihu',
|
|
|
|
label: 'West Lake',
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
value: 'jiangsu',
|
|
|
|
label: 'Jiangsu',
|
|
|
|
children: [{
|
|
|
|
value: 'nanjing',
|
|
|
|
label: 'Nanjing',
|
|
|
|
children: [{
|
|
|
|
value: 'zhonghuamen',
|
|
|
|
label: 'Zhong Hua Men',
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
}];
|
2017-04-22 09:28:44 +08:00
|
|
|
|
|
|
|
class CompactDemo extends React.Component {
|
|
|
|
state = {
|
|
|
|
dataSource: [],
|
|
|
|
}
|
|
|
|
handleChange = (value) => {
|
|
|
|
this.setState({
|
|
|
|
dataSource: !value || value.indexOf('@') >= 0 ? [] : [
|
|
|
|
`${value}@gmail.com`,
|
|
|
|
`${value}@163.com`,
|
|
|
|
`${value}@qq.com`,
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<InputGroup size="large">
|
2018-03-02 15:26:05 +08:00
|
|
|
<Col span={5}>
|
2017-04-22 09:28:44 +08:00
|
|
|
<Input defaultValue="0571" />
|
|
|
|
</Col>
|
2017-06-15 15:34:47 +08:00
|
|
|
<Col span={8}>
|
2017-04-22 09:28:44 +08:00
|
|
|
<Input defaultValue="26888888" />
|
|
|
|
</Col>
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Input style={{ width: '20%' }} defaultValue="0571" />
|
|
|
|
<Input style={{ width: '30%' }} defaultValue="26888888" />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="Zhejiang">
|
|
|
|
<Option value="Zhejiang">Zhejiang</Option>
|
|
|
|
<Option value="Jiangsu">Jiangsu</Option>
|
|
|
|
</Select>
|
|
|
|
<Input style={{ width: '50%' }} defaultValue="Xihu District, Hangzhou" />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="Option1">
|
|
|
|
<Option value="Option1">Option1</Option>
|
|
|
|
<Option value="Option2">Option2</Option>
|
|
|
|
</Select>
|
|
|
|
<Input style={{ width: '50%' }} defaultValue="input content" />
|
|
|
|
<InputNumber />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Input style={{ width: '50%' }} defaultValue="input content" />
|
|
|
|
<DatePicker />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="Option1-1">
|
|
|
|
<Option value="Option1-1">Option1-1</Option>
|
|
|
|
<Option value="Option1-2">Option1-2</Option>
|
|
|
|
</Select>
|
|
|
|
<Select defaultValue="Option2-2">
|
|
|
|
<Option value="Option2-1">Option2-1</Option>
|
|
|
|
<Option value="Option2-2">Option2-2</Option>
|
|
|
|
</Select>
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="1">
|
|
|
|
<Option value="1">Between</Option>
|
|
|
|
<Option value="2">Except</Option>
|
|
|
|
</Select>
|
|
|
|
<Input style={{ width: 100, textAlign: 'center' }} placeholder="Minimum" />
|
2018-01-10 15:34:38 +08:00
|
|
|
<Input style={{ width: 30, borderLeft: 0, pointerEvents: 'none', backgroundColor: '#fff' }} placeholder="~" disabled />
|
2017-04-22 09:28:44 +08:00
|
|
|
<Input style={{ width: 100, textAlign: 'center', borderLeft: 0 }} placeholder="Maximum" />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="Sign Up">
|
|
|
|
<Option value="Sign Up">Sign Up</Option>
|
|
|
|
<Option value="Sign In">Sign In</Option>
|
|
|
|
</Select>
|
|
|
|
<AutoComplete
|
|
|
|
dataSource={this.state.dataSource}
|
|
|
|
style={{ width: 200 }}
|
|
|
|
onChange={this.handleChange}
|
|
|
|
placeholder="Email"
|
|
|
|
/>
|
|
|
|
</InputGroup>
|
2017-04-26 15:17:35 +08:00
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select style={{ width: '30%' }} defaultValue="Home">
|
|
|
|
<Option value="Home">Home</Option>
|
|
|
|
<Option value="Company">Company</Option>
|
|
|
|
</Select>
|
|
|
|
<Cascader style={{ width: '70%' }} options={options} placeholder="Select Address" />
|
|
|
|
</InputGroup>
|
2017-04-22 09:28:44 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<CompactDemo />, mountNode);
|
2016-05-25 18:21:27 +08:00
|
|
|
````
|