Skip to content

Commit 9e6ea98

Browse files
committed
fix: header item navigation loop
1 parent 1076067 commit 9e6ea98

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/components/layout/header/config.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
FaSolidDotCircle,
99
FaSolidFeatherAlt,
1010
FaSolidHistory,
11-
FaSolidSubway,
1211
FaSolidUserFriends,
1312
IcTwotoneSignpost,
1413
IonBook,
@@ -95,9 +94,9 @@ export const headerMenuConfig: IHeaderMenu[] = [
9594
},
9695
],
9796
},
98-
{
99-
title: '开往',
100-
icon: h(FaSolidSubway),
101-
path: 'https://travellings.link',
102-
},
97+
// {
98+
// title: '开往',
99+
// icon: h(FaSolidSubway),
100+
// path: 'https://travellings.link',
101+
// },
103102
]

src/components/layout/header/internal/HeaderContent.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,19 @@ function AnimatedItem({
190190
className?: string
191191
isActive?: boolean
192192
}) {
193+
const isExternal = href.startsWith('http')
194+
const As = isExternal ? 'a' : Link
193195
return (
194196
<div>
195-
<Link
197+
<As
196198
href={href}
197199
className={clsxm(
198200
'relative block whitespace-nowrap px-4 py-2 transition',
199201
isActive ? 'text-accent' : 'hover:text-accent-focus',
200202
isActive ? 'active' : '',
201203
className,
202204
)}
205+
target={isExternal ? '_blank' : undefined}
203206
>
204207
{children}
205208
{isActive && (
@@ -211,7 +214,7 @@ function AnimatedItem({
211214
layoutId="active-nav-item"
212215
/>
213216
)}
214-
</Link>
217+
</As>
215218
</div>
216219
)
217220
}

0 commit comments

Comments
 (0)