Skip to content

Commit 596014f

Browse files
committed
fix: nav link highlight issue with i18n (close: #445)
1 parent 45063ae commit 596014f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/default-theme/NavLink.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class="nav-link"
44
:to="link"
55
v-if="!isExternal(link)"
6-
:exact="link === '/'"
6+
:exact="exact"
77
>{{ item.text }}</router-link>
88
<a
99
v-else
@@ -29,6 +29,12 @@ export default {
2929
computed: {
3030
link () {
3131
return ensureExt(this.item.link)
32+
},
33+
exact () {
34+
if (this.$site.locales) {
35+
return Object.keys(this.$site.locales).some(rootLink => rootLink === this.link)
36+
}
37+
return this.link === '/'
3238
}
3339
},
3440
methods: {

0 commit comments

Comments
 (0)