2020-06-04 23:12:37 +08:00
|
|
|
---
|
|
|
|
order: 99
|
|
|
|
title:
|
|
|
|
zh-CN: ConfigProvider
|
|
|
|
en-US: ConfigProvider
|
|
|
|
debug: true
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
支持 ConfigProvider 配置。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
config by ConfigProvider.
|
|
|
|
|
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Button, ConfigProvider, Drawer } from 'antd';
|
|
|
|
import React, { useRef, useState } from 'react';
|
2020-06-04 23:12:37 +08:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
2020-12-17 15:09:18 +08:00
|
|
|
const domRef = useRef<HTMLDivElement>(null);
|
2022-08-23 14:52:37 +08:00
|
|
|
const [open, setOpen] = useState(false);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
2020-06-04 23:12:37 +08:00
|
|
|
const showDrawer = () => {
|
2022-08-23 14:52:37 +08:00
|
|
|
setOpen(true);
|
2020-06-04 23:12:37 +08:00
|
|
|
};
|
2022-05-19 09:46:26 +08:00
|
|
|
|
2020-06-04 23:12:37 +08:00
|
|
|
const onClose = () => {
|
2022-08-23 14:52:37 +08:00
|
|
|
setOpen(false);
|
2020-06-04 23:12:37 +08:00
|
|
|
};
|
2022-05-19 09:46:26 +08:00
|
|
|
|
2020-06-04 23:12:37 +08:00
|
|
|
return (
|
2021-02-23 10:45:11 +08:00
|
|
|
<ConfigProvider getPopupContainer={() => domRef.current!}>
|
2020-06-04 23:12:37 +08:00
|
|
|
<div ref={domRef} className="site-drawer-render-in-current-wrapper">
|
|
|
|
<Button type="primary" onClick={showDrawer}>
|
|
|
|
Open
|
|
|
|
</Button>
|
|
|
|
<Drawer
|
|
|
|
style={{ position: 'absolute' }}
|
|
|
|
title="ConfigProvider"
|
|
|
|
placement="right"
|
|
|
|
onClose={onClose}
|
2022-08-23 14:52:37 +08:00
|
|
|
open={open}
|
2020-06-04 23:12:37 +08:00
|
|
|
>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
</Drawer>
|
|
|
|
</div>
|
|
|
|
</ConfigProvider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default App;
|
2020-06-04 23:12:37 +08:00
|
|
|
```
|