We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 466f752 + 80f86c8 commit 873f1f1Copy full SHA for 873f1f1
src/components/layout/TheToc.vue
@@ -1,6 +1,10 @@
1
<script setup lang="ts">
2
+import { breakpointsTailwind } from '@vueuse/core'
3
import type { Ref } from 'vue'
4
5
+const breakpoints = useBreakpoints(breakpointsTailwind)
6
+const xlAndLarger = breakpoints.greater('xl')
7
+
8
interface Toc {
9
header: string
10
id: string
@@ -34,16 +38,21 @@ const getObserver = () => {
34
38
})
35
39
}
36
40
41
+const initToc = () => {
42
+ if (xlAndLarger.value) {
43
+ createToc()
44
+ getObserver()
45
+ }
46
+}
47
37
48
const route = useRoute()
49
onMounted(() => {
- createToc()
- getObserver()
50
+ initToc()
51
52
53
watch(route, () => {
54
nextTick(() => {
55
56
57
58
</script>
0 commit comments