fix(theme): watch for changes in props.collapsed (#809) (#811)

pull/812/head
Divyansh Singh 2 years ago committed by GitHub
parent 107724ac6f
commit 773769926b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme' import type { DefaultTheme } from 'vitepress/theme'
import { ref } from 'vue' import { ref, watchEffect } from 'vue'
import VPIconPlusSquare from './icons/VPIconPlusSquare.vue' import VPIconPlusSquare from './icons/VPIconPlusSquare.vue'
import VPIconMinusSquare from './icons/VPIconMinusSquare.vue' import VPIconMinusSquare from './icons/VPIconMinusSquare.vue'
import VPSidebarLink from './VPSidebarLink.vue' import VPSidebarLink from './VPSidebarLink.vue'
@ -12,7 +12,10 @@ const props = defineProps<{
collapsed?: boolean collapsed?: boolean
}>() }>()
const collapsed = ref(props.collapsible && props.collapsed) const collapsed = ref(false)
watchEffect(() => {
collapsed.value = !!(props.collapsible && props.collapsed)
})
function toggle() { function toggle() {
if (props.collapsible) { if (props.collapsible) {

Loading…
Cancel
Save