From 55aea542df7bdef969396464aceae7822e2774c3 Mon Sep 17 00:00:00 2001 From: ayangweb <75017711+ayangweb@users.noreply.github.com> Date: Wed, 23 Jul 2025 21:16:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E3=80=8C=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E8=AE=BE=E7=BD=AE=20>=20=E5=A4=96=E8=A7=82=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=20>=20=E4=B8=BB=E9=A2=98=E6=A8=A1=E5=BC=8F=E3=80=8D?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9=20(#583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/capabilities/default.json | 1 + src/App.vue | 10 +++- src/components/pro-list-item/index.vue | 2 +- src/pages/main/index.vue | 25 +++++++-- .../general/components/theme-mode/index.vue | 53 +++++++++++++++++++ .../preference/components/general/index.vue | 5 ++ src/pages/preference/index.vue | 8 +-- src/stores/general.ts | 14 ++++- src/stores/model.ts | 26 +-------- 9 files changed, 108 insertions(+), 36 deletions(-) create mode 100644 src/pages/preference/components/general/components/theme-mode/index.vue diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index e376498..f8a746d 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -14,6 +14,7 @@ "core:window:allow-set-ignore-cursor-events", "core:window:allow-set-decorations", "core:window:allow-set-position", + "core:window:allow-set-theme", "custom-window:default", "os:default", "process:default", diff --git a/src/App.vue b/src/App.vue index 47d59f8..480aa02 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,7 +3,7 @@ import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow' import { error } from '@tauri-apps/plugin-log' import { openUrl } from '@tauri-apps/plugin-opener' import { useEventListener } from '@vueuse/core' -import { ConfigProvider } from 'ant-design-vue' +import { ConfigProvider, theme } from 'ant-design-vue' import zhCN from 'ant-design-vue/es/locale/zh_CN' import { isString } from 'es-toolkit' import isURL from 'is-url' @@ -29,6 +29,7 @@ const generalStore = useGeneralStore() const shortcutStore = useShortcutStore() const appWindow = getCurrentWebviewWindow() const { isRestored, restoreState } = useWindowState() +const { darkAlgorithm, defaultAlgorithm } = theme onMounted(async () => { generateColorVars() @@ -79,7 +80,12 @@ useEventListener('click', (event) => { diff --git a/src/components/pro-list-item/index.vue b/src/components/pro-list-item/index.vue index 02ed296..da1fde5 100644 --- a/src/components/pro-list-item/index.vue +++ b/src/components/pro-list-item/index.vue @@ -18,7 +18,7 @@ const hasDescription = computed(() => {