vp-table-of-content.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script setup lang="ts">
  2. import { computed, ref } from 'vue'
  3. import { useToc } from '../../composables/use-toc'
  4. import { useActiveSidebarLinks } from '../../composables/active-bar'
  5. // import sponsorLocale from '../../../i18n/component/sponsor.json'
  6. import { useLang } from '../../composables/lang'
  7. // import SponsorsButton from '../sponsors/sponsors-button.vue'
  8. // import SponsorRightTextList from '../sponsors/right-richtext-list.vue'
  9. // import SponsorRightLogoSmallList from '../sponsors/right-logo-small-list.vue'
  10. // import SponsorLarge from '../vp-sponsor-large.vue'
  11. const headers = useToc()
  12. const marker = ref()
  13. const container = ref()
  14. useActiveSidebarLinks(container, marker)
  15. const lang = useLang()
  16. // const sponsor = computed(() => sponsorLocale[lang.value])
  17. </script>
  18. <template>
  19. <aside ref="container" class="toc-wrapper">
  20. <nav class="toc-content">
  21. <h3 class="toc-content__heading">Contents</h3>
  22. <ul class="toc-items">
  23. <li v-for="{ link, text, children } in headers" :key="link" class="toc-item">
  24. <a class="toc-link" :href="link" :title="text">{{ text }}</a>
  25. <ul v-if="children">
  26. <li v-for="{ link: childLink, text: childText } in children" :key="childLink" class="toc-item">
  27. <a class="toc-link subitem" :href="childLink" :title="text">{{ childText }}</a>
  28. </li>
  29. </ul>
  30. </li>
  31. </ul>
  32. <div ref="marker" class="toc-marker" />
  33. <!-- <SponsorLarge
  34. class="mt-8 toc-ads flex flex-col"
  35. item-style="width: 180px; height: 55px;"
  36. /> -->
  37. <!-- <p class="text-14px font-300 color-$text-color-secondary">
  38. {{ sponsor.sponsoredBy }}
  39. </p> -->
  40. <!-- <sponsors-button class="sponsors-button mt-4 w-100%" />
  41. <sponsor-right-logo-small-list />
  42. <sponsor-right-text-list /> -->
  43. </nav>
  44. </aside>
  45. </template>
  46. <style scoped lang="scss">
  47. .sponsors-button:deep {
  48. button {
  49. width: 100%;
  50. }
  51. }
  52. </style>