Skip to content

Commit 5429bee

Browse files
author
EndlessPixel
committed
修复面包屑导航跳转问题
1 parent 4458f63 commit 5429bee

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

components/navigation.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,18 @@ function ExplorerBar() {
8989
};
9090

9191
/* 面包屑生成 ------------------------------------------------------- */
92-
const crumbs = pathname
93-
.split('/')
94-
.filter(Boolean)
95-
.reduce<Array<{ href: string; label: string }>>(
96-
(acc, seg) => {
97-
const href = `${acc.at(-1)?.href || ''}/${seg}`;
98-
acc.push({ href, label: formatLabel(seg) });
99-
return acc;
100-
},
101-
[{ href: '/', label: '首页' }]
102-
);
92+
const crumbs = pathname
93+
.split('/')
94+
.filter(Boolean)
95+
.reduce<Array<{ href: string; label: string }>>(
96+
(acc, seg) => {
97+
const parent = acc.at(-1)?.href || '/';
98+
const href = (parent.endsWith('/') ? parent : parent + '/') + seg;
99+
acc.push({ href, label: formatLabel(seg) });
100+
return acc;
101+
},
102+
[{ href: '/', label: '首页' }]
103+
);
103104

104105
return (
105106
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@@ -166,10 +167,10 @@ export function Navigation() {
166167
useLockBody(isMenuOpen);
167168

168169
const navItems = [
169-
{ href: '/', label: '首页', icon: Home, description: '返回主页' },
170-
{ href: '/downloads', label: '资源下载', icon: Download, description: '模组包下载' },
170+
{ href: '/', label: '首页', icon: Home, description: '主页' },
171+
{ href: '/downloads', label: '资源下载', icon: Download, description: '模组包/启动器下载' },
171172
{ href: '/status', label: '状态查询', icon: Activity, description: '服务器状态' },
172-
{ href: '/wiki', label: 'Wiki', icon: BookOpen, description: '游戏百科' },
173+
{ href: '/wiki', label: 'Wiki', icon: BookOpen, description: '服务器专属百科' },
173174
{ href: '/about', label: '关于我们', icon: Users, description: '团队介绍' }
174175
];
175176

0 commit comments

Comments
 (0)