fix(theme): fix collection type error when the homepage is set as a posts, close #729 (#732)

This commit is contained in:
pengzhanbo 2025-10-17 20:19:52 +08:00 committed by GitHub
parent 6325d097cb
commit 0a23b94232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@ import VPPostsExtract from '@theme/Posts/VPPostsExtract.vue'
import VPPostsNav from '@theme/Posts/VPPostsNav.vue'
import VPPostsTags from '@theme/Posts/VPPostsTags.vue'
import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
import { watch } from 'vue'
import { onBeforeUnmount, watch } from 'vue'
import { forceUpdateCollection, useData } from '../../composables/index.js'
const props = defineProps<{
@ -24,6 +24,8 @@ watch(
() => forceUpdateCollection(props.homePosts ? (props.collection || true) : undefined),
{ immediate: true },
)
onBeforeUnmount(() => forceUpdateCollection(undefined))
</script>
<template>