提交 1e49ccab 作者: ZhangLingKun

功能:代码优化

上级 d7177297
流水线 #7437 已通过 于阶段
in 4 分 52 秒
......@@ -79,7 +79,8 @@
"jsx-a11y/no-static-element-interactions": "off",
"eqeqeq": "warn",
"no-unsafe-optional-chaining": "warn",
"no-param-reassign": "warn"
"no-param-reassign": "warn",
"react-hooks/exhaustive-deps": "off"
}
}
]
......
......@@ -30,10 +30,12 @@ const BreadcrumbView: React.FC = () => {
];
// 转换路由
const getCurrentRouter = () => {
return `/${router?.pathname
?.split('/')
?.filter((i) => i)
?.at(0)}`;
return (
`/${router?.pathname
?.split('/')
?.filter((i) => i)
?.at(0)}` || '/'
);
};
return (
<BreadcrumbWrap>
......@@ -47,7 +49,7 @@ const BreadcrumbView: React.FC = () => {
},
{
title: routerList.find((i) => i.path === getCurrentRouter())?.name,
href: router?.pathname,
href: getCurrentRouter(),
},
]}
/>
......
import React from 'react';
import { useRouter } from 'next/router';
import HomeBottomView from '@/pages/home/comp/home-bottom';
import HomeBrandView from '@/pages/home/comp/home-brand';
import HomeMapView from '@/pages/home/comp/home-map';
......@@ -14,7 +13,7 @@ import { HomeWrap } from '@/pages/home/styled';
const HomeView = () => {
// 路由钩子
const router = useRouter();
// const router = useRouter();
// 消息提醒
// const handleClick = async () => {
// await message.success('你好');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论