From ec4f5a9856c0e4b4ed1f156f45131aceca8758a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Tue, 20 Jan 2026 19:59:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/App.vue | 4 +- client/src/components/Header.vue | 265 +++++++++++++----- client/src/components/Icon.vue | 11 +- client/src/components/StarBackground.vue | 2 +- client/src/pages/BlogDetail.vue | 31 +- .../src/pages/admin/dashboard/Analytics.vue | 8 - 6 files changed, 216 insertions(+), 105 deletions(-) diff --git a/client/src/App.vue b/client/src/App.vue index 2e53d84..85d57e1 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -16,10 +16,10 @@
-
+
- + diff --git a/client/src/components/Header.vue b/client/src/components/Header.vue index ecbc4ff..e7c1199 100644 --- a/client/src/components/Header.vue +++ b/client/src/components/Header.vue @@ -1,88 +1,189 @@ \ No newline at end of file diff --git a/client/src/components/Icon.vue b/client/src/components/Icon.vue index fb9eaf6..4d4e44b 100644 --- a/client/src/components/Icon.vue +++ b/client/src/components/Icon.vue @@ -3,7 +3,7 @@ :is="iconComponent" :class="className" :style="style" - :size="size" + :size="iconSize" /> @@ -35,4 +35,13 @@ const iconComponent = computed(() => { const iconName = toPascalCase(props.name) as keyof typeof LucideIcons return LucideIcons[iconName] || LucideIcons.AlertCircle }) + +// 确保 size 是 number 类型 +const iconSize = computed(() => { + if (typeof props.size === 'string') { + const parsed = parseInt(props.size, 10) + return isNaN(parsed) ? 24 : parsed + } + return props.size ?? 24 +}) \ No newline at end of file diff --git a/client/src/components/StarBackground.vue b/client/src/components/StarBackground.vue index a45e1ac..4696321 100644 --- a/client/src/components/StarBackground.vue +++ b/client/src/components/StarBackground.vue @@ -198,7 +198,7 @@ const updateAndDrawParticles = () => { } } -const createMeteor = (force = false) => { +const createMeteor = () => { const startX = Math.random() * width const angle = Math.PI / 4 // 45度 meteors.push({ diff --git a/client/src/pages/BlogDetail.vue b/client/src/pages/BlogDetail.vue index 495b8eb..33fa685 100644 --- a/client/src/pages/BlogDetail.vue +++ b/client/src/pages/BlogDetail.vue @@ -381,8 +381,8 @@ md.renderer.rules.fence = function (tokens, idx) { const lines = token.content.trimEnd().split('\n') const lineNumbers = lines.map((_, i) => i + 1).join('\n') - // SVG Icon 手动嵌入,不使用 Icon 组件 - const copyIconSvg = `` + // 修复1: 显式定义的 SVG Icon,颜色更亮 (text-white/70),去除复杂 opacity 类 + const copyIconSvg = `` return `
@@ -396,10 +396,10 @@ md.renderer.rules.fence = function (tokens, idx) {
${langName || 'TEXT'}
- - @@ -408,9 +408,9 @@ md.renderer.rules.fence = function (tokens, idx) {
${lineNumbers}
- -
-
${highlighted}
+ +
+
${highlighted}
@@ -506,7 +506,7 @@ const addCopyListeners = () => { const text = codeElement.innerText await navigator.clipboard.writeText(text) const originalContent = newBtn.innerHTML - const checkIconSvg = `` + const checkIconSvg = `` newBtn.innerHTML = `${checkIconSvg}已复制` setTimeout(() => { newBtn.innerHTML = originalContent @@ -603,24 +603,22 @@ onBeforeUnmount(() => { border-radius: 0 !important; box-shadow: none !important; border: none !important; - white-space: pre !important; /* 关键:强制不自动换行 */ + /* 确保这里也强制 pre */ + white-space: pre !important; } :deep(.prose code) { font-family: 'SF Mono', Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - white-space: pre !important; /* 关键:强制不自动换行 */ } -/* 覆盖 highlight.js 或其他样式可能带来的换行 */ :deep(.code-block-wrapper pre code) { white-space: pre !important; word-wrap: normal !important; overflow-wrap: normal !important; } -/* 允许容器横向滚动 */ :deep(.code-block-wrapper) { - -webkit-overflow-scrolling: touch; /* iOS 惯性滚动 */ + -webkit-overflow-scrolling: touch; } :deep(.prose :not(pre) > code) { @@ -629,7 +627,8 @@ onBeforeUnmount(() => { padding: 0.2em 0.4em; border-radius: 0.3em; font-weight: 500; - word-break: break-word; /* 内联代码允许换行,防止撑开 */ + /* 内联代码依然需要换行 */ + word-break: break-word; } :deep(.prose h1), :deep(.prose h2), :deep(.prose h3) { diff --git a/client/src/pages/admin/dashboard/Analytics.vue b/client/src/pages/admin/dashboard/Analytics.vue index d09e798..7c7f887 100644 --- a/client/src/pages/admin/dashboard/Analytics.vue +++ b/client/src/pages/admin/dashboard/Analytics.vue @@ -299,14 +299,6 @@ const uvTrendOption = computed(() => ({ }] })) -// 所有省份列表(用于设置默认值) -const allProvinces = [ - '北京', '天津', '河北', '山西', '内蒙古', '辽宁', '吉林', '黑龙江', - '上海', '江苏', '浙江', '安徽', '福建', '江西', '山东', '河南', - '湖北', '湖南', '广东', '广西', '海南', '重庆', '四川', '贵州', - '云南', '西藏', '陕西', '甘肃', '青海', '宁夏', '新疆', '台湾', '香港', '澳门' -] - // 所有省份完整名称列表(用于匹配地图数据) const allProvincesFullNames = [ '北京市', '天津市', '河北省', '山西省', '内蒙古自治区', '辽宁省', '吉林省', '黑龙江省',