mirror of https://github.com/vuejs/vitepress
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
988 B
52 lines
988 B
<script lang="ts" setup>
|
|
import { useData } from '../composables/data.js'
|
|
import { isActive } from '../support/utils.js'
|
|
import VPLink from './VPLink.vue'
|
|
|
|
defineProps<{
|
|
item: any
|
|
}>()
|
|
|
|
const { page } = useData()
|
|
</script>
|
|
|
|
<template>
|
|
<div class="VPMenuLink">
|
|
<VPLink
|
|
:class="{ active: isActive(page.relativePath, item.activeMatch || item.link, !!item.activeMatch) }"
|
|
:href="item.link"
|
|
>
|
|
{{ item.text }}
|
|
</VPLink>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.VPMenuGroup + .VPMenuLink {
|
|
margin: 12px -12px 0;
|
|
border-top: 1px solid var(--vp-c-divider);
|
|
padding: 12px 12px 0;
|
|
}
|
|
|
|
.link {
|
|
display: block;
|
|
border-radius: 6px;
|
|
padding: 0 12px;
|
|
line-height: 32px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
color: var(--vp-c-text-1);
|
|
white-space: nowrap;
|
|
transition: background-color 0.25s, color 0.25s;
|
|
}
|
|
|
|
.link:hover {
|
|
color: var(--vp-c-brand);
|
|
background-color: var(--vp-c-bg-elv-mute);
|
|
}
|
|
|
|
.link.active {
|
|
color: var(--vp-c-brand);
|
|
}
|
|
</style>
|