修改H1-H6和表格,strong字体
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<template>
|
||||
<h2
|
||||
:id
|
||||
class="scroll-m-20 border-b border-gray-200 dark:border-gray-700 pb-2 text-3xl font-semibold tracking-tight transition-colors [&:not(:first-child)]:mt-10 mb-2"
|
||||
:class="['scroll-m-20 inline-block text-white font-semibold tracking-tight transition-colors [&:not(:first-child)]:mt-10 mb-2', themeSizeClass, themePaddingClass]"
|
||||
:style="h2Style"
|
||||
>
|
||||
<NuxtLink
|
||||
v-if="id && generate"
|
||||
:to="`#${id}`"
|
||||
class="no-underline"
|
||||
>
|
||||
<slot />
|
||||
</NuxtLink>
|
||||
@@ -16,6 +18,37 @@
|
||||
<script setup lang="ts">
|
||||
const { id } = defineProps<{ id?: string }>()
|
||||
|
||||
// 读取主题,用主题主色 + 圆角变量渲染带底色的 H2
|
||||
const { selectedTheme, selectedThemeColor, customColor, themeColors } = useTheme()
|
||||
|
||||
// 这个计算属性 themeSizeClass 用于根据当前主题(selectedTheme)动态设置 h1 标题的字号样式:
|
||||
// - 如果主题是 minimal,则使用较小字号 'text-2xl lg:text-3xl'
|
||||
// - 否则(classic 或 elegant),使用较大字号 'text-3xl lg:text-4xl'
|
||||
const themeSizeClass = computed(() => {
|
||||
return selectedTheme.value === 'classic'
|
||||
? 'text-xl lg:text-1xl '
|
||||
: 'text-1xl lg:text-2xl'
|
||||
})
|
||||
|
||||
// 经典:更贴合文字(小内边距);优雅/简洁:略大(更舒展)
|
||||
const themePaddingClass = computed(() => {
|
||||
return selectedTheme.value === 'classic'
|
||||
? 'px-1 py-0.5'
|
||||
: 'px-5 py-2'
|
||||
})
|
||||
|
||||
const { headings } = useRuntimeConfig().public.mdc
|
||||
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
||||
|
||||
// 背景颜色取主题主色;若为自定义颜色,则取 customColor
|
||||
const primaryHex = computed(() => {
|
||||
if (selectedThemeColor.value === 'custom') return customColor.value
|
||||
const found = themeColors.find(c => c.value === selectedThemeColor.value)
|
||||
return found?.color || '#3B82F6' // fallback 经典蓝
|
||||
})
|
||||
|
||||
const h2Style = computed(() => ({
|
||||
backgroundColor: primaryHex.value,
|
||||
borderRadius: 'var(--ui-card-radius)',
|
||||
}))
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user