mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-10 03:00:10 +08:00
增加初始化page
This commit is contained in:
parent
b6d432798c
commit
0fabdf7da7
@ -1,2 +0,0 @@
|
|||||||
export * from './login';
|
|
||||||
export * from './layout';
|
|
5
src/pages/index/index.tsx
Normal file
5
src/pages/index/index.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const IndexPage = () => {
|
||||||
|
return <>我是首页</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default IndexPage;
|
11
src/pages/init/index.tsx
Normal file
11
src/pages/init/index.tsx
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
interface Props {}
|
||||||
|
|
||||||
|
export const InitPage = (props: Props) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Outlet />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
@ -1,3 +0,0 @@
|
|||||||
export const LayoutPage = () => {
|
|
||||||
return <>我是布局文件</>
|
|
||||||
}
|
|
@ -1,21 +1,27 @@
|
|||||||
import { lazy } from "react";
|
import { lazy } from "react";
|
||||||
import { RouteObject } from "react-router-dom";
|
import { RouteObject } from "react-router-dom";
|
||||||
|
|
||||||
import { LayoutPage } from "../pages";
|
import { InitPage } from "../pages/init";
|
||||||
|
|
||||||
// 懒加载
|
// 懒加载
|
||||||
const LoginPage = lazy(() => import('../pages/login'))
|
const LoginPage = lazy(() => import("../pages/login"));
|
||||||
|
const IndexPage = lazy(() => import("../pages/index"));
|
||||||
|
|
||||||
const routes: RouteObject[] = [
|
const routes: RouteObject[] = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <LayoutPage />,
|
element: <InitPage />,
|
||||||
children: [],
|
children: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <IndexPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
element: <LoginPage />,
|
element: <LoginPage />,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default routes;
|
export default routes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user