mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
51 lines
917 B
Vue
51 lines
917 B
Vue
|
<script lang="ts" setup>
|
||
|
import { useData, useRoute } from 'vitepress'
|
||
|
import VPLink from '../common/vp-link.vue'
|
||
|
import { isActiveLink } from '../../utils'
|
||
|
|
||
|
import type { Link } from '../../types'
|
||
|
|
||
|
defineProps<{
|
||
|
item: Link
|
||
|
}>()
|
||
|
|
||
|
const route = useRoute()
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<VPLink
|
||
|
:class="{
|
||
|
'is-menu-link': true,
|
||
|
active: isActiveLink(
|
||
|
route,
|
||
|
item.activeMatch || item.link,
|
||
|
!!item.activeMatch
|
||
|
),
|
||
|
}"
|
||
|
:href="item.link"
|
||
|
:no-icon="true"
|
||
|
>
|
||
|
{{ item.text }}
|
||
|
</VPLink>
|
||
|
</template>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.is-menu-link {
|
||
|
display: block;
|
||
|
padding: 0 12px;
|
||
|
line-height: calc(var(--nav-height) - 3px);
|
||
|
font-size: 14px;
|
||
|
font-weight: 500;
|
||
|
color: var(--text-color);
|
||
|
transition: color var(--el-transition-duration);
|
||
|
|
||
|
&.active {
|
||
|
border-bottom: 2px solid var(--brand-color);
|
||
|
}
|
||
|
|
||
|
&:hover {
|
||
|
color: var(--brand-color);
|
||
|
}
|
||
|
}
|
||
|
</style>
|