From b520e234a181dd8bb3737c85b288dcd213dcb182 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 28 Oct 2021 09:52:21 +0800 Subject: [PATCH] feat: update --- package.json | 2 +- src/layout/components/setting/index.vue | 59 ++++++++++++++++++++++++- src/layout/types.ts | 5 +++ src/plugins/element-plus/index.ts | 4 +- src/utils/storage/responsive.ts | 3 +- types/global.d.ts | 1 + vite.config.ts | 4 +- yarn.lock | 12 ++--- 8 files changed, 76 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 1af1e2cfd..9556d8c64 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@vue/compiler-sfc": "^3.2.20", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", - "@zougt/vite-plugin-theme-preprocessor": "^1.2.0", + "@zougt/vite-plugin-theme-preprocessor": "^1.3.1", "autoprefixer": "^10.2.4", "babel-plugin-transform-remove-console": "^6.9.4", "chalk": "^2.4.2", diff --git a/src/layout/components/setting/index.vue b/src/layout/components/setting/index.vue index fb9e97eec..b40d9dede 100644 --- a/src/layout/components/setting/index.vue +++ b/src/layout/components/setting/index.vue @@ -4,6 +4,7 @@ import { useRouter } from "vue-router"; import { emitter } from "/@/utils/mitt"; import { templateRef } from "@vueuse/core"; import { debounce } from "/@/utils/debounce"; +import { themeColorsType } from "../../types"; import { useAppStoreHook } from "/@/store/modules/app"; import { storageLocal, storageSession } from "/@/utils/storage"; import { @@ -18,6 +19,27 @@ import { const router = useRouter(); const { isSelect } = useCssModule(); +let themeColors = ref>([ + // 暗雅(默认) + { rgb: "27, 42, 71", themeColor: "layout-theme-default" }, + // 明亮 + { rgb: "255, 255, 255", themeColor: "layout-theme-light" }, + // 薄暮 + { rgb: "245, 34, 45", themeColor: "layout-theme-dusk" }, + // 火山 + { rgb: "250, 84, 28", themeColor: "layout-theme-volcano" }, + // 日暮 + { rgb: "250, 84, 28", themeColor: "layout-theme-higurashi" }, + // 明青 + { rgb: "19, 194, 194", themeColor: "layout-theme-mingQing" }, + // 极光绿 + { rgb: "82, 196, 26", themeColor: "layout-theme-auroraGreen" }, + // 极客蓝 + { rgb: "47, 84, 235", themeColor: "layout-theme-geekBlue" }, + // 酱紫 + { rgb: "114, 46, 209", themeColor: "layout-theme-saucePurple" } +]); + const instance = getCurrentInstance().appContext.app.config.globalProperties.$storage; @@ -177,8 +199,16 @@ function setTheme(layout: string) { 主题色 -