ant-design/components/input/demo/addon.md

68 lines
1.4 KiB
Markdown
Raw Normal View History

2016-06-16 22:18:00 +08:00
---
order: 2
title:
zh-CN: 前置/后置标签
en-US: Pre / Post tab
2016-06-16 22:18:00 +08:00
---
## zh-CN
2016-06-16 22:18:00 +08:00
用于配置一些固定组合。
## en-US
Using pre & post tabs example.
2019-05-07 14:57:32 +08:00
```jsx
import { Input, Select, Space, Cascader } from 'antd';
import { SettingOutlined } from '@ant-design/icons';
2018-06-27 15:55:04 +08:00
const { Option } = Select;
2016-06-16 22:18:00 +08:00
const selectBefore = (
<Select defaultValue="http://" className="select-before">
<Option value="http://">http://</Option>
<Option value="https://">https://</Option>
2016-06-16 22:18:00 +08:00
</Select>
);
const selectAfter = (
<Select defaultValue=".com" className="select-after">
2016-06-16 22:18:00 +08:00
<Option value=".com">.com</Option>
<Option value=".jp">.jp</Option>
<Option value=".cn">.cn</Option>
<Option value=".org">.org</Option>
</Select>
);
export default () => (
<Space direction="vertical">
<Input addonBefore="http://" addonAfter=".com" defaultValue="mysite" />
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
<Input addonAfter={<SettingOutlined />} defaultValue="mysite" />
<Input addonBefore="http://" suffix=".com" defaultValue="mysite" />
<Input
addonBefore={<Cascader placeholder="cascader" style={{ width: 150 }} />}
defaultValue="mysite"
/>
</Space>
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```
```css
.select-before {
width: 90px;
}
.select-after {
width: 80px;
}
[data-theme='compact'] .select-before {
width: 71px;
}
[data-theme='compact'] .select-after {
width: 65px;
}
```