fix: nav menu link don't show active status (#680)

Co-authored-by: Kia King Ishii <kia.king.08@gmail.com>
pull/681/head
Percy Ma 2 years ago committed by GitHub
parent ae7c255aea
commit 1db3730a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,21 @@
<script lang="ts" setup>
import { useData } from 'vitepress'
import { isActive } from '../support/utils'
import VPLink from './VPLink.vue'
defineProps<{
item: any
}>()
const { page } = useData()
</script>
<template>
<VPLink class="VPMenuLink" :href="item.link">
<VPLink
class="VPMenuLink"
:class="{ active: isActive(page.relativePath, item.activeMatch || item.link) }"
:href="item.link"
>
{{ item.text }}
</VPLink>
</template>
@ -33,4 +41,8 @@ defineProps<{
.dark .VPMenuLink:hover {
background-color: var(--vp-c-bg-soft);
}
.VPMenuLink.active {
color: var(--vp-c-brand);
}
</style>

Loading…
Cancel
Save