We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd94379 commit a5ece97Copy full SHA for a5ece97
src/App.tsx
@@ -72,11 +72,10 @@ const StyledLink = styled(Link)(({ theme }) => ({
72
function NavLinks() {
73
const location = useLocation();
74
75
- // 修复路由匹配逻辑,使用hash路由的pathname
+ // 精确匹配当前路由路径
76
const isActive = (path: string) => {
77
- const hashPath = location.hash.replace('#', '');
78
- if (path === '/') return hashPath === '/';
79
- return hashPath.startsWith(path);
+ const currentPath = location.pathname;
+ return currentPath === path;
80
};
81
82
return (
@@ -96,7 +95,7 @@ function NavLinks() {
96
95
97
function MainApp() {
98
99
- <Router basename="/">
+ <Router>
100
<AppBar
101
position="static"
102
color="default"
0 commit comments