Skip to content

Commit

Permalink
fix(AppFooter): 🐛 no SuggestionBox
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi committed Sep 21, 2024
1 parent 1fc6e66 commit 58938e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import antfu from '@antfu/eslint-config'

export default antfu({
formatters: true,
unocss: true,
// unocss: true,
typescript: true,
vue: true,
ignores: [
Expand Down
31 changes: 16 additions & 15 deletions src/components/AppFooter.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<script setup lang="ts">
import { ref, watch, } from 'vue';
import { NolebaseGitChangelog } from '@nolebase/vitepress-plugin-git-changelog/client';
import { useRoute } from 'vitepress';
import { NolebaseGitChangelog } from '@nolebase/vitepress-plugin-git-changelog/client'
import { useRoute } from 'vitepress'
import { ref, watch } from 'vue'
import { AppSBox } from '../components'
const route = useRoute();
const route = useRoute()
// 定义一个 ref 来存储动态 key
const componentKey = ref(0);
const frontmatter = ref({});
const isFrontmatterLoaded = ref(false);
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;
};
function updateKeyAndFrontmatter() {
componentKey.value += 1
frontmatter.value = route.data?.frontmatter || {}
isFrontmatterLoaded.value = true
}
// 监听路由变化,更新 key 和 frontmatter
watch(() => route.path, () => {
isFrontmatterLoaded.value = false;
updateKeyAndFrontmatter();
}, { immediate: true }); // 在组件挂载时立即执行一次,确保第一次渲染时 key 和 frontmatter 是正确的
isFrontmatterLoaded.value = false
updateKeyAndFrontmatter()
}, { immediate: true }) // 在组件挂载时立即执行一次,确保第一次渲染时 key 和 frontmatter 是正确的
// 在组件挂载时更新 key 和 frontmatter
// onMounted(updateKeyAndFrontmatter);
Expand Down

0 comments on commit 58938e8

Please sign in to comment.