路由丢失页添加

This commit is contained in:
禺狨 2023-03-02 14:31:16 +08:00
parent 569d478e15
commit 0bf57e8b6c
5 changed files with 9 additions and 2 deletions

View File

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import styles from "./Error.module.css";
export const ErrorPage: React.FC<any> = () => { export const ErrorPage: React.FC<any> = () => {
return ( return (

1
src/pages/error/index.ts Normal file
View File

@ -0,0 +1 @@
export * from "./Error";

View File

@ -1,3 +1,4 @@
export * from "./home"; export * from "./home";
export * from "./login"; export * from "./login";
export * from "./dashboard"; export * from "./dashboard";
export * from "./error";

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { RouteObject } from "react-router-dom"; import { RouteObject } from "react-router-dom";
import { Login, HomePage, Dashboard } from "../pages"; import { Login, HomePage, Dashboard, ErrorPage } from "../pages";
const routes: RouteObject[] = [ const routes: RouteObject[] = [
{ {
@ -17,6 +17,10 @@ const routes: RouteObject[] = [
path: "/login", path: "/login",
element: <Login />, element: <Login />,
}, },
{
path: "*",
element: <ErrorPage />,
},
]; ];
export default routes; export default routes;