fix(theme): add slot existence check in VPDocFooter, close #809 (#811)

This commit is contained in:
pengzhanbo 2026-01-09 15:19:52 +08:00 committed by GitHub
parent 7ed70230af
commit 2cadb7d88c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
<script lang="ts" setup>
import VPLink from '@theme/VPLink.vue'
import { computed } from 'vue'
import { computed, inject, ref, toValue } from 'vue'
import {
useContributors,
useData,
@ -29,12 +29,16 @@ const hasLastUpdated = computed(() =>
)
const hasContributors = computed(() => Boolean(contributors.value.length) && mode.value === 'inline')
// doc-footer provide
const hasSlot = inject('doc-footer-slot-exists', ref(false))
const showFooter = computed(() => {
return hasEditLink.value
|| hasLastUpdated.value
|| hasContributors.value
|| prev.value?.link
|| next.value?.link
|| toValue(hasSlot)
})
</script>