From 3cece05fc07b501f6af413c34a3c7e3e0c151b6a Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 21 Apr 2023 13:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(switch):=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2=EF=BC=8C=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=E5=B0=B1=E6=98=AF=E6=9B=B4=E6=94=B9=E9=85=8D=E8=89=B2=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 5 ++++- src/assets/index.css | 2 ++ src/components/t-sidebar.vue | 28 +++++++++++++++++++++++++++- src/themes/common/index.css | 6 ------ src/themes/dark/index.css | 9 --------- src/themes/light/index.css | 9 --------- 6 files changed, 33 insertions(+), 26 deletions(-) delete mode 100644 src/themes/common/index.css delete mode 100644 src/themes/dark/index.css delete mode 100644 src/themes/light/index.css diff --git a/src/App.vue b/src/App.vue index 80fcc63a..9ca43214 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,6 +42,9 @@ const appStore = useAppStore(); const isMain = ref(true as boolean); onMounted(async () => { + // 获取当前主题 + const theme = appStore.theme; + document.documentElement.className = theme; // 获取当前窗口 const win = window.getCurrent(); isMain.value = win.label === "tauri-genshin"; @@ -93,7 +96,7 @@ async function writeIndex () { diff --git a/src/assets/index.css b/src/assets/index.css index 0a27cbf5..15a3a7f3 100644 --- a/src/assets/index.css +++ b/src/assets/index.css @@ -1,4 +1,6 @@ @import "fonts/index.css"; +@import url("themes/default.css"); +@import url("themes/dark.css"); /* * @description 侧边滚动条样式 diff --git a/src/components/t-sidebar.vue b/src/components/t-sidebar.vue index eb85d5be..755a6ddf 100644 --- a/src/components/t-sidebar.vue +++ b/src/components/t-sidebar.vue @@ -1,5 +1,5 @@ --> + + +