From a32c2ae27bcc788463f08df971dd2a857ea9942a Mon Sep 17 00:00:00 2001 From: lbw Date: Thu, 12 Sep 2024 03:53:43 +0000 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=20tailwindcss=20=E6=B7=B1?= =?UTF-8?q?=E8=89=B2=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lbw --- src/layout/navBars/breadcrumb/setings.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/layout/navBars/breadcrumb/setings.vue b/src/layout/navBars/breadcrumb/setings.vue index 09232268..65e14662 100644 --- a/src/layout/navBars/breadcrumb/setings.vue +++ b/src/layout/navBars/breadcrumb/setings.vue @@ -553,8 +553,14 @@ const onAddFilterChange = (attr: string) => { // 4、界面显示 --> 深色模式 const onAddDarkChange = () => { const body = document.documentElement as HTMLElement; - if (getThemeConfig.value.isIsDark) body.setAttribute('data-theme', 'dark'); - else body.setAttribute('data-theme', ''); + if (getThemeConfig.value.isIsDark) { + body.setAttribute('data-theme', 'dark'); + // body 再增加一个 dark : true 的class ,用于tailwindcss 判断是否是深色 + body.classList.add('dark'); + } else { + body.classList.remove('dark'); + body.setAttribute('data-theme', ''); + } }; // 4、界面显示 --> 开启水印 const onWartermarkChange = () => {