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

49 lines
1.1 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.
2017-02-13 10:55:53 +08:00
````jsx
import { Input, Select, Icon } from 'antd';
2016-06-16 22:18:00 +08:00
const Option = Select.Option;
const selectBefore = (
<Select defaultValue="Http://" style={{ width: 80 }}>
<Option value="Http://">Http://</Option>
<Option value="Https://">Https://</Option>
</Select>
);
const selectAfter = (
<Select defaultValue=".com" style={{ width: 70 }}>
<Option value=".com">.com</Option>
<Option value=".jp">.jp</Option>
<Option value=".cn">.cn</Option>
<Option value=".org">.org</Option>
</Select>
);
ReactDOM.render(
<div>
<div style={{ marginBottom: 16 }}>
<Input addonBefore="Http://" addonAfter=".com" defaultValue="mysite" />
</div>
<div style={{ marginBottom: 16 }}>
2016-06-16 22:18:00 +08:00
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
</div>
<div style={{ marginBottom: 16 }}>
<Input addonAfter={<Icon type="setting" />} defaultValue="mysite" />
</div>
2016-06-16 22:18:00 +08:00
</div>
, mountNode);
````