You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
686 B
32 lines
686 B
6 years ago
|
---
|
||
|
category: Components
|
||
|
subtitle: 全局化配置
|
||
|
cols: 1
|
||
|
type: 其他
|
||
|
title: ConfigProvider
|
||
|
---
|
||
|
|
||
|
为组件提供统一的全局化配置。
|
||
|
|
||
|
## 使用
|
||
|
|
||
|
ConfigProvider 使用 React 的 [context](https://facebook.github.io/react/docs/context.html) 特性,只需在应用外围包裹一次即可全局生效。
|
||
|
|
||
|
```jsx
|
||
|
import { ConfigProvider } from 'antd';
|
||
|
|
||
|
// ...
|
||
|
|
||
|
return (
|
||
|
<ConfigProvider {...yourConfig}>
|
||
|
<App />
|
||
|
</ConfigProvider>
|
||
|
);
|
||
|
```
|
||
|
|
||
|
## API
|
||
|
|
||
|
| 参数 | 说明 | 类型 | 默认值 |
|
||
|
| --- | --- | --- | --- |
|
||
|
| getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | Function(triggerNode) | () => document.body |
|