element-plus/docs/.vitepress/vitepress/components/doc-content/vp-table-of-content.vue
jeremywu 9408e7eb76
feat(docs): document add changelog page (#3596)
* feat(docs): document add changelog page

- Add changelog and markdown component for changelog.md
- Add changelog page
- Add some locale for change log
- Fix a bug that caused ToC not working

* Add minimal width to changelog selector

* Add width to changelog selector

* fix selector width issue
2021-09-24 01:19:18 +08:00

38 lines
1.0 KiB
Vue

<script setup lang="ts">
import { ref } from 'vue'
import { useToc } from '../../composables/use-toc'
import { useActiveSidebarLinks } from '../../composables/active-bar'
const headers = useToc()
const marker = ref()
const container = ref()
useActiveSidebarLinks(container, marker)
</script>
<template>
<aside ref="container" class="toc-wrapper">
<nav class="toc-content">
<h3 class="toc-content__heading">Contents</h3>
<ul class="toc-items">
<li
v-for="{ link, text, children } in headers"
:key="link"
class="toc-item"
>
<a class="toc-link" :href="link">{{ text }}</a>
<ul v-if="children">
<li
v-for="{ link: childLink, text: childText } in children"
:key="childLink"
class="toc-item"
>
<a class="toc-link subitem" :href="childLink">{{ childText }}</a>
</li>
</ul>
</li>
</ul>
<div ref="marker" class="toc-marker"></div>
</nav>
</aside>
</template>