mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +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>
38 lines
1.0 KiB
Vue
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="{ childLink, 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>
|