mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 14:44:47 +08:00
32 lines
686 B
Markdown
32 lines
686 B
Markdown
|
---
|
|||
|
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 |
|