提交 2896895e 作者: 翁进城

增加路由/重写向到/home的判断

上级 16cdcd70
...@@ -3,9 +3,9 @@ import { Navigate, RouteObject } from 'react-router-dom'; ...@@ -3,9 +3,9 @@ import { Navigate, RouteObject } from 'react-router-dom';
import ErrorPage from '~/pages/common/error'; import ErrorPage from '~/pages/common/error';
import LayoutView from '~/components/layout'; import LayoutView from '~/components/layout';
const Home = React.lazy(() => import('~/pages/home')); //首页 const Home = React.lazy(() => import('~/pages/home')); //首页
const JobServices = React.lazy(() => import('~/pages/jobServices')); //工作服务 const JobServices = React.lazy(() => import('~/pages/jobServices')); //工作服务
const Mall = React.lazy(() => import('~/pages/mall')); //产品商城 const Mall = React.lazy(() => import('~/pages/mall')); //产品商城
interface RouteObjectType { interface RouteObjectType {
meta?: { meta?: {
...@@ -25,11 +25,7 @@ export const routerList: Array<RouteObject & RouteObjectType> = [ ...@@ -25,11 +25,7 @@ export const routerList: Array<RouteObject & RouteObjectType> = [
}, },
{ {
path: '/', path: '/',
element: ( element: <LayoutView>{location.hash === '#/' && <Navigate to='/home' />}</LayoutView>,
<LayoutView>
<Navigate to='/home' />
</LayoutView>
),
errorElement: <ErrorPage />, errorElement: <ErrorPage />,
children: [ children: [
{ {
...@@ -41,9 +37,9 @@ export const routerList: Array<RouteObject & RouteObjectType> = [ ...@@ -41,9 +37,9 @@ export const routerList: Array<RouteObject & RouteObjectType> = [
element: <JobServices />, element: <JobServices />,
}, },
{ {
path: 'mall', path: '/mall',
element: <Mall /> element: <Mall />,
} },
], ],
} },
]; ];
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论