修复:暂时修复 Footer 组件在带有侧边栏的页面引起的遮盖问题(后续等待 vitepress 官方开放 useSidebar 再进行优化)

This commit is contained in:
2022-08-16 17:53:47 +08:00
parent de7e62a824
commit 2592ba3582

View File

@@ -4,18 +4,25 @@
<Comment v-if="(theme.commentConfig?.showComment ?? true) && (frontmatter?.showComment ?? true)" :commentConfig="theme.commentConfig" :key="md5(page.relativePath)" />
</template>
<template #layout-bottom>
<Footer v-if="(theme.footerConfig?.showFooter ?? true) && (frontmatter?.showFooter ?? true)" />
<Footer v-if="!hasSidebar && (theme.footerConfig?.showFooter ?? true) && (frontmatter?.showFooter ?? true)" />
</template>
</Layout>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import DefaultTheme from 'vitepress/theme'
import { useData } from 'vitepress'
import md5 from 'blueimp-md5'
const { Layout } = DefaultTheme
const { page, theme, frontmatter } = useData()
const hasSidebar = computed(() => {
return (
frontmatter.value.aside !== false &&
frontmatter.value.layout !== 'home'
)
})
</script>
<style scoped>