From cdbca16c87d81449f8e28d52ce7f5be64f2b6043 Mon Sep 17 00:00:00 2001 From: zouzhibing Date: Tue, 13 Sep 2022 21:18:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/u-theme/index.vue | 49 ++++++++++++++++++++------ src/layout/Header/index.vue | 9 +++-- src/layout/Sidebar/components/Menu.vue | 2 +- src/layout/index.vue | 5 +-- src/store/modules/setting.ts | 10 +++++- 5 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/components/u-theme/index.vue b/src/components/u-theme/index.vue index cfb6c30..a6d4640 100644 --- a/src/components/u-theme/index.vue +++ b/src/components/u-theme/index.vue @@ -14,6 +14,18 @@ +
+ + + + + +
@@ -23,16 +35,12 @@
- - - - - + + +
+
+ +
@@ -42,6 +50,14 @@
+
+ + +
+
+ + +
@@ -57,7 +73,11 @@ const layout = ref(SettingStore.themeConfig.mode) const showTag = ref(SettingStore.themeConfig.showTag) const showLogo = ref(SettingStore.themeConfig.showLogo) + const uniqueOpened = ref(SettingStore.themeConfig.uniqueOpened) const primary = ref(SettingStore.themeConfig.primary) + const fixedHeader = ref(SettingStore.themeConfig.fixedHeader) + const gray = ref(SettingStore.themeConfig.gray) + const weak = ref(SettingStore.themeConfig.weak) const drawer = computed({ get() { @@ -105,6 +125,15 @@ changeSwitch('primary',val) } + // 修改灰色模式 + const changeGrayWeak = (type,val)=>{ + const body = document.documentElement as HTMLElement; + if (!val) return body.setAttribute("style", ""); + if (type === "gray") body.setAttribute("style", "filter: grayscale(1)"); + if (type === "weak") body.setAttribute("style", "filter: invert(80%)"); + changeSwitch(type,val) + } +