mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
d8954f945e
* chore: make eslints work in docs folder * refactor(dev): improve eslint * fix eslint issue Co-authored-by: Kevin <sxzz@sxzz.moe> Co-authored-by: jeremywuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com>
52 lines
944 B
Vue
52 lines
944 B
Vue
<script lang="ts" setup>
|
|
import { 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);
|
|
border-bottom: 2px solid transparent;
|
|
|
|
&.active {
|
|
border-bottom-color: var(--brand-color);
|
|
}
|
|
|
|
&:hover {
|
|
color: var(--brand-color);
|
|
}
|
|
}
|
|
</style>
|