vp-table-of-content.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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
  24. v-for="{ link, text, children } in headers"
  25. :key="link"
  26. class="toc-item"
  27. >
  28. <a class="toc-link" :href="link" :title="text">{{ text }}</a>
  29. <ul v-if="children">
  30. <li
  31. v-for="{ link: childLink, text: childText } in children"
  32. :key="childLink"
  33. class="toc-item"
  34. >
  35. <a class="toc-link subitem" :href="childLink" :title="text">{{
  36. childText
  37. }}</a>
  38. </li>
  39. </ul>
  40. </li>
  41. </ul>
  42. <div ref="marker" class="toc-marker" />
  43. <!-- <SponsorLarge
  44. class="mt-8 toc-ads flex flex-col"
  45. item-style="width: 180px; height: 55px;"
  46. /> -->
  47. <p class="text-14px font-300 color-$text-color-secondary">
  48. {{ sponsor.sponsoredBy }}
  49. </p>
  50. <sponsors-button class="sponsors-button mt-4 w-100%" />
  51. <sponsor-right-logo-small-list />
  52. <sponsor-right-text-list />
  53. </nav>
  54. </aside>
  55. </template>
  56. <style scoped lang="scss">
  57. .sponsors-button:deep {
  58. button {
  59. width: 100%;
  60. }
  61. }
  62. </style>