From 34072b33d01e3b299e9d6f11168c01f9b3b0cb83 Mon Sep 17 00:00:00 2001 From: anghunk Date: Tue, 27 Jan 2026 11:31:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=A0=B7=E5=BC=8F):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9A=97=E9=BB=91=E4=B8=BB=E9=A2=98=E4=B8=8B=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BE=B9=E6=A1=86=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复评论组件在暗黑主题下边框显示异常的问题: - 移除评论头部的固定底部边框,改由主题变量控制 - 修正主题变量作用域,确保变量在容器内生效 - 优化主题初始化逻辑,默认使用亮色主题 - 添加主题切换监听,支持动态切换亮色/暗黑主题 --- docs/.vitepress/components/footerDoc.vue | 21 ++++++++++++++++++++- docs/widget/src/core/CWDComments.js | 5 ++--- docs/widget/src/styles/main.css | 1 - docs/widget/src/styles/variables.css | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/.vitepress/components/footerDoc.vue b/docs/.vitepress/components/footerDoc.vue index fc0e2d9..adad0bd 100644 --- a/docs/.vitepress/components/footerDoc.vue +++ b/docs/.vitepress/components/footerDoc.vue @@ -3,9 +3,14 @@ diff --git a/docs/widget/src/core/CWDComments.js b/docs/widget/src/core/CWDComments.js index 24071fd..98c9559 100644 --- a/docs/widget/src/core/CWDComments.js +++ b/docs/widget/src/core/CWDComments.js @@ -126,9 +126,8 @@ export class CWDComments { this.mountPoint = document.createElement('div'); this.mountPoint.className = 'cwd-comments-container'; this.shadowRoot.appendChild(this.mountPoint); - if (this.config.theme) { - this.mountPoint.setAttribute('data-theme', this.config.theme); - } + const theme = this.config.theme || 'light'; + this.mountPoint.setAttribute('data-theme', theme); this._applyCustomCss(); } diff --git a/docs/widget/src/styles/main.css b/docs/widget/src/styles/main.css index 84c1c3a..1cd979b 100644 --- a/docs/widget/src/styles/main.css +++ b/docs/widget/src/styles/main.css @@ -41,7 +41,6 @@ .cwd-comments-header { padding: 16px 0; - border-bottom: 1px solid var(--cwd-border); } .cwd-comments-count { diff --git a/docs/widget/src/styles/variables.css b/docs/widget/src/styles/variables.css index 0940a51..4233612 100644 --- a/docs/widget/src/styles/variables.css +++ b/docs/widget/src/styles/variables.css @@ -3,7 +3,7 @@ * 支持主题切换 */ -:root, +.cwd-comments-container, [data-theme="light"] { /* 主色调 */ --cwd-primary: #0969da;