mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
71 lines
1.5 KiB
Markdown
71 lines
1.5 KiB
Markdown
---
|
|
order: 2
|
|
title:
|
|
zh-CN: 前置/后置标签
|
|
en-US: Pre / Post tab
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
用于配置一些固定组合。
|
|
|
|
## en-US
|
|
|
|
Using pre & post tabs example.
|
|
|
|
```tsx
|
|
import { SettingOutlined } from '@ant-design/icons';
|
|
import { Cascader, Input, Select, Space } from 'antd';
|
|
import React from 'react';
|
|
|
|
const { Option } = Select;
|
|
|
|
const selectBefore = (
|
|
<Select defaultValue="http://" className="select-before">
|
|
<Option value="http://">http://</Option>
|
|
<Option value="https://">https://</Option>
|
|
</Select>
|
|
);
|
|
const selectAfter = (
|
|
<Select defaultValue=".com" className="select-after">
|
|
<Option value=".com">.com</Option>
|
|
<Option value=".jp">.jp</Option>
|
|
<Option value=".cn">.cn</Option>
|
|
<Option value=".org">.org</Option>
|
|
</Select>
|
|
);
|
|
|
|
const App: React.FC = () => (
|
|
<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>
|
|
);
|
|
|
|
export default App;
|
|
```
|
|
|
|
```css
|
|
.select-before {
|
|
width: 90px;
|
|
}
|
|
|
|
.select-after {
|
|
width: 80px;
|
|
}
|
|
|
|
[data-theme='compact'] .select-before {
|
|
width: 71px;
|
|
}
|
|
|
|
[data-theme='compact'] .select-after {
|
|
width: 65px;
|
|
}
|
|
```
|