refactor: 更新AppFooter.vue组件 (#408)
部署文档 / build (push) Has been cancelled Details

pull/413/head
Lee 2024-09-11 14:55:54 +08:00 committed by GitHub
parent 43434248f7
commit 7240ee2332
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 3 deletions

View File

@ -1,13 +1,39 @@
<script setup lang="ts">
import { NolebaseGitChangelog } from '@nolebase/vitepress-plugin-git-changelog/client'
import { ref, watch, onMounted } from 'vue';
import { NolebaseGitChangelog } from '@nolebase/vitepress-plugin-git-changelog/client';
import { useRoute } from 'vitepress';
const route = useRoute();
// ref key
const componentKey = ref(0);
const frontmatter = ref({});
const isFrontmatterLoaded = ref(false);
// key frontmatter
const updateKeyAndFrontmatter = () => {
componentKey.value += 1;
frontmatter.value = route.data?.frontmatter || {};
isFrontmatterLoaded.value = true;
};
// key frontmatter
watch(() => route.path, () => {
isFrontmatterLoaded.value = false;
updateKeyAndFrontmatter();
});
// key frontmatter
onMounted(updateKeyAndFrontmatter);
</script>
<template>
<div class="vp-doc">
<div :key="componentKey" class="vp-doc">
<h2 id="意见反馈">
意见反馈
</h2>
<AppSBox />
<NolebaseGitChangelog />
<!-- 仅在 Frontmatter 加载完成且未设置 hideChangelog 时渲染 GitChangelog -->
<NolebaseGitChangelog v-if="isFrontmatterLoaded && !frontmatter.hideChangelog" />
</div>
</template>