提交 1e49ccab 作者: ZhangLingKun

功能:代码优化

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