2021-08-31 13:09:03 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title:
|
|
|
|
zh-CN: 前置/后置标签
|
|
|
|
en-US: Pre / Post tab
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
用于配置一些固定组合。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Using pre & post tabs example.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2021-08-31 13:09:03 +08:00
|
|
|
import { SettingOutlined } from '@ant-design/icons';
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Cascader, InputNumber, Select, Space } from 'antd';
|
|
|
|
import React from 'react';
|
2021-08-31 13:09:03 +08:00
|
|
|
|
|
|
|
const { Option } = Select;
|
|
|
|
|
|
|
|
const selectBefore = (
|
2021-10-09 11:21:39 +08:00
|
|
|
<Select defaultValue="add" style={{ width: 60 }}>
|
2021-08-31 13:09:03 +08:00
|
|
|
<Option value="add">+</Option>
|
|
|
|
<Option value="minus">-</Option>
|
|
|
|
</Select>
|
|
|
|
);
|
|
|
|
const selectAfter = (
|
2021-10-09 11:21:39 +08:00
|
|
|
<Select defaultValue="USD" style={{ width: 60 }}>
|
2021-08-31 13:09:03 +08:00
|
|
|
<Option value="USD">$</Option>
|
|
|
|
<Option value="EUR">€</Option>
|
|
|
|
<Option value="GBP">£</Option>
|
|
|
|
<Option value="CNY">¥</Option>
|
|
|
|
</Select>
|
|
|
|
);
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2021-08-31 13:09:03 +08:00
|
|
|
<Space direction="vertical">
|
|
|
|
<InputNumber addonBefore="+" addonAfter="$" defaultValue={100} />
|
|
|
|
<InputNumber addonBefore={selectBefore} addonAfter={selectAfter} defaultValue={100} />
|
|
|
|
<InputNumber addonAfter={<SettingOutlined />} defaultValue={100} />
|
|
|
|
<InputNumber
|
|
|
|
addonBefore={<Cascader placeholder="cascader" style={{ width: 150 }} />}
|
|
|
|
defaultValue={100}
|
|
|
|
/>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Space>
|
2021-08-31 13:09:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2021-08-31 13:09:03 +08:00
|
|
|
```
|