diff --git a/src/App.tsx b/src/App.tsx index 8e63992..cc355fc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,14 +1,16 @@ import { useRoutes } from "react-router-dom"; import routes from "./routes"; import "./App.scss"; +import { Suspense } from "react"; +import LoadingPage from "./pages/loading"; function App() { const Views = () => useRoutes(routes); return ( -
+ }> -
+ ); } diff --git a/src/pages/loading/index.tsx b/src/pages/loading/index.tsx new file mode 100644 index 0000000..df80a52 --- /dev/null +++ b/src/pages/loading/index.tsx @@ -0,0 +1,11 @@ +import { Spin } from "antd"; + +const LoadingPage = () => { + return ( + <> + + + ); +}; + +export default LoadingPage; diff --git a/src/routes/index.tsx b/src/routes/index.tsx index f0bd5c7..536a473 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -3,6 +3,7 @@ import { RouteObject } from "react-router-dom"; import { LayoutPage } from "../pages"; +// 懒加载 const LoginPage = lazy(() => import('../pages/login')) const routes: RouteObject[] = [