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
|
2019-08-13 14:07:17 +08:00
|
|
|
import { Input, Select } 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>
|
|
|
|
);
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2020-04-23 18:11:11 +08:00
|
|
|
<>
|
2016-11-08 11:46:41 +08:00
|
|
|
<div style={{ marginBottom: 16 }}>
|
2020-02-10 15:26:32 +08:00
|
|
|
<Input addonBefore="http://" addonAfter=".com" defaultValue="mysite" />
|
2016-11-08 11:46:41 +08:00
|
|
|
</div>
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
2016-06-16 22:18:00 +08:00
|
|
|
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
|
|
|
|
</div>
|
2016-11-08 11:46:41 +08:00
|
|
|
<div style={{ marginBottom: 16 }}>
|
2019-11-28 12:34:33 +08:00
|
|
|
<Input addonAfter={<SettingOutlined />} defaultValue="mysite" />
|
2016-11-08 11:46:41 +08:00
|
|
|
</div>
|
2020-02-10 15:26:32 +08:00
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
|
<Input addonBefore="http://" suffix=".com" defaultValue="mysite" />
|
|
|
|
</div>
|
2020-04-23 18:11:11 +08:00
|
|
|
</>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
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;
|
|
|
|
}
|
|
|
|
```
|