优化全局提醒
This commit is contained in:
18
src/App.tsx
18
src/App.tsx
@@ -1,8 +1,24 @@
|
||||
import React from 'react';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { router } from './router';
|
||||
import { App as AntdApp } from 'antd';
|
||||
import utils from './lib/utils';
|
||||
|
||||
// 用于静态注入 message/modal/notification
|
||||
const StaticAntd = () => {
|
||||
const { message, modal, notification } = AntdApp.useApp();
|
||||
utils.setMessage(message);
|
||||
utils.setModal(modal);
|
||||
utils.setNotification(notification);
|
||||
return null;
|
||||
};
|
||||
|
||||
export default function App() {
|
||||
|
||||
return <RouterProvider router={router} />;
|
||||
return (
|
||||
<AntdApp>
|
||||
<StaticAntd />
|
||||
<RouterProvider router={router} />
|
||||
</AntdApp>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user