2016-06-16 22:18:00 +08:00
|
|
|
---
|
|
|
|
order: 2
|
2016-08-22 09:53:39 +08:00
|
|
|
title:
|
2019-01-25 11:06:05 +08:00
|
|
|
zh-CN: 前置/后置标签
|
|
|
|
en-US: Pre / Post tab
|
2016-06-16 22:18:00 +08:00
|
|
|
---
|
|
|
|
|
2016-08-22 09:53:39 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-06-16 22:18:00 +08:00
|
|
|
用于配置一些固定组合。
|
|
|
|
|
2016-08-22 09:53:39 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Using pre & post tabs example.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2021-07-12 13:25:41 +08:00
|
|
|
import { Input, Select, Space, Cascader } from 'antd';
|
2019-11-28 12:34:33 +08:00
|
|
|
import { SettingOutlined } from '@ant-design/icons';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-05-27 21:32:45 +08:00
|
|
|
const { Option } = Select;
|
2016-06-16 22:18:00 +08:00
|
|
|
|
|
|
|
const selectBefore = (
|
2020-03-29 10:39:46 +08:00
|
|
|
<Select defaultValue="http://" className="select-before">
|
2020-02-10 15:26:32 +08:00
|
|
|
<Option value="http://">http://</Option>
|
|
|
|
<Option value="https://">https://</Option>
|
2016-06-16 22:18:00 +08:00
|
|
|
</Select>
|
|
|
|
);
|
|
|
|
const selectAfter = (
|
2020-03-29 10:39:46 +08:00
|
|
|
<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>
|
|
|
|
);
|
|
|
|
|
2022-04-03 23:27:45 +08:00
|
|
|
export default () => (
|
2021-07-12 13:25:41 +08:00
|
|
|
<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"
|
|
|
|
/>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Space>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2020-03-29 10:39:46 +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;
|
|
|
|
}
|
|
|
|
```
|