字体、字号设置完毕

This commit is contained in:
2025-07-24 23:54:47 +08:00
parent 69bb151c6e
commit 1788e72ba5
3 changed files with 136 additions and 6 deletions

View File

@@ -10,6 +10,14 @@ const route = useRoute()
const appConfig = useAppConfig()
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
// 获取主题系统的字号设置
const { selectedFontSize } = useTheme()
// 计算页面内容的字号类
const pageFontSizeClass = computed(() => {
return `text-${selectedFontSize.value}`
})
const { data: page } = await useAsyncData(route.path, () => queryCollection('docs').path(route.path).first())
if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
@@ -68,7 +76,7 @@ const links = computed(() => {
</script>
<template>
<UPage v-if="page">
<UPage v-if="page" :class="pageFontSizeClass">
<UPageHeader
:title="page.title"
:description="page.description"