Skip to content

Commit 0229c78

Browse files
committed
✨ 更新页面标题设置逻辑,统一使用状态管理
1 parent 6c22eaf commit 0229c78

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

pages/about/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ if (error.value) {
77
console.error('Failed to load markdown content:', error.value)
88
}
99
10+
const title = useState<string>('pageTitle')
11+
title.value = testMd.value?.title || 'Default Title'
12+
13+
useHead({
14+
title: title,
15+
})
1016
useSeoMeta({
11-
title: testMd.value?.title || 'Default Title',
17+
title: title || 'Default Title',
1218
description: testMd.value?.description || 'Default Description',
1319
})
1420
</script>

pages/index.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ import { ref, onMounted } from 'vue'
33
import Logo from '@/assets/logo.svg'
44
import GridBackground from '@/components/Background/GridBackground.vue'
55
6+
const title = useState<string>('pageTitle')
7+
title.value = 'MSCPO'
8+
9+
useHead({
10+
title: title,
11+
})
12+
613
// 设置使用home布局,仅首页使用
714
definePageMeta({
815
layout: 'home',
916
})
1017
11-
// 设置页面标题
12-
useHead({
13-
title: 'Minecraft集体宣传组织(MSCPO)',
14-
})
1518
1619
const isLoaded = ref(false)
1720
const showContent = ref(false)

0 commit comments

Comments
 (0)