Skip to content

Commit

Permalink
feat: Add support of path prop
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyujie2002 committed Sep 20, 2024
1 parent ce99a4d commit d573dcc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/runtime/components/TableOfContents.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<CustomQuery
v-slot="{ data }"
:path="$route.path"
:path="resolvedPath"
:only="['body']"
find="one"
>
Expand Down Expand Up @@ -45,11 +45,21 @@

<script setup lang="ts">
import CustomQuery from './CustomQuery.vue'
import { ref, onMounted, onUnmounted } from '#imports'
import { ref, onMounted, onUnmounted, useRoute, computed } from '#imports'
const activeTocIds = ref<Set<string>>(new Set())
const lastVisibleHeading = ref<string>('')
const props = defineProps({
path: {
type: String,
default: ''
}
})
const route = useRoute()
const resolvedPath = computed(() => props.path || route.path)
const observeSections = () => {
const options = {
root: null,
Expand Down

0 comments on commit d573dcc

Please sign in to comment.