2021-01-19 17:33:05 +08:00
|
|
|
---
|
|
|
|
order: 99
|
|
|
|
title:
|
|
|
|
zh-CN: 前缀
|
|
|
|
en-US: prefixCls
|
|
|
|
debug: true
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
修改组件和图标前缀。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Config component and icon prefixCls.
|
|
|
|
|
|
|
|
```jsx
|
2021-05-24 11:46:12 +08:00
|
|
|
import { ConfigProvider, Select, Button } from 'antd';
|
2021-01-19 17:33:05 +08:00
|
|
|
import { SmileOutlined } from '@ant-design/icons';
|
2021-05-24 11:46:12 +08:00
|
|
|
import React, { useState } from 'react';
|
2021-01-19 17:33:05 +08:00
|
|
|
|
|
|
|
// Ant Design site use `es` module for view
|
|
|
|
// but do not replace related lib `lib` with `es`
|
|
|
|
// which do not show correct in site.
|
|
|
|
// We may need do convert in site also.
|
2021-05-24 11:46:12 +08:00
|
|
|
const FormSizeDemo = () => {
|
|
|
|
const [prefixCls, setPrefixCls] = useState('light');
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Button style={{ marginBottom: '12px' }} type="primary" onClick={() => setPrefixCls('dark')}>
|
|
|
|
toggle prefixCls
|
|
|
|
</Button>
|
|
|
|
<div>
|
|
|
|
<ConfigProvider prefixCls={prefixCls} iconPrefixCls="bamboo">
|
|
|
|
<SmileOutlined />
|
|
|
|
<Select />
|
|
|
|
</ConfigProvider>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2021-01-19 17:33:05 +08:00
|
|
|
ReactDOM.render(<FormSizeDemo />, mountNode);
|
|
|
|
```
|