24 lines
744 B
Vue
24 lines
744 B
Vue
<script setup lang="ts">
|
|
import { Link } from "@heroui-vue/components";
|
|
import { withBase } from "vitepress";
|
|
import type { DocsGroup } from "./navigation";
|
|
defineProps<{ groups: DocsGroup[]; current: string; label?: string }>();
|
|
const emit = defineEmits<{ navigate: [] }>();
|
|
</script>
|
|
<template>
|
|
<nav :aria-label="label ?? '文档导航'" class="sidebar-tree">
|
|
<section v-for="group in groups" :key="group.title">
|
|
<h2>{{ group.title }}</h2>
|
|
<Link
|
|
v-for="item in group.items"
|
|
:key="item.url"
|
|
:href="withBase(item.url)"
|
|
:aria-current="current === item.url ? 'page' : undefined"
|
|
@click="emit('navigate')"
|
|
>
|
|
{{ item.title }}
|
|
</Link>
|
|
</section>
|
|
</nav>
|
|
</template>
|