From 766b14240ddda25fad3ae1e4d3b3b048d25633ef Mon Sep 17 00:00:00 2001 From: ShineTomorrow Date: Fri, 6 Jan 2023 02:59:04 +0800 Subject: [PATCH] :sparkles: feat(project): add theme feature dark light system model --- src/libs/Button/index.vue | 8 ++-- src/libs/Popover/index.vue | 2 +- src/libs/Popup/index.vue | 2 +- src/libs/Search/index.vue | 6 +-- src/main.js | 4 +- src/store/getters.js | 1 + src/store/index.js | 5 +- src/store/modules/theme.js | 12 +++++ src/utils/theme.js | 47 +++++++++++++++++++ src/views/layout/components/header/index.vue | 2 +- .../components/header/profile/index.vue | 12 +++-- .../layout/components/header/theme/index.vue | 29 +++++++++--- src/views/main/components/menu/index.vue | 8 +++- .../components/navigation/mobile/index.vue | 8 ++-- .../main/components/navigation/pc/index.vue | 13 +++-- tailwind.config.cjs | 3 ++ 16 files changed, 129 insertions(+), 33 deletions(-) create mode 100644 src/store/modules/theme.js create mode 100644 src/utils/theme.js diff --git a/src/libs/Button/index.vue b/src/libs/Button/index.vue index 8b894d1..adc4b15 100644 --- a/src/libs/Button/index.vue +++ b/src/libs/Button/index.vue @@ -37,9 +37,10 @@ import { computed } from 'vue'; // size 大小 区分文字按钮和icon按钮 const typeEnum = { - primary: 'text-white bg-zinc-800 hover:bg-zinc-900 active:bg-zinc-800', - main: 'text-white bg-main hover:bg-hover-main active:bg-hover-main', - info: 'text-zinc-800 bg-zinc-200 hover:bg-zinc-300 active:bg-zinc-200', + primary: + 'text-white bg-zinc-800 dark:bg-zinc-900 hover:bg-zinc-900 dark:hover:bg-zinc-700 active:bg-zinc-800 dark:active:bg-zinc-700', + main: 'text-white bg-main dark:bg-zinc-900 hover:bg-hover-main dark:hover:bg-zinc-700 active:bg-hover-main dark:active:bg-zinc-700', + info: 'text-zinc-800 dark:text-zinc-300 bg-zinc-200 dark:bg-zinc-700 hover:bg-zinc-300 dark:hover:bg-zinc-600 active:bg-zinc-200 dark:active:bg-zinc-700', }; const sizeEnum = { // 文字按钮 @@ -88,7 +89,6 @@ const props = defineProps({ type: String, default: 'main', validator(val) { - console.log('[ val ]', val); const keys = Object.keys(typeEnum); const result = keys.includes(val); if (!result) { diff --git a/src/libs/Popover/index.vue b/src/libs/Popover/index.vue index e449e9a..f406d75 100644 --- a/src/libs/Popover/index.vue +++ b/src/libs/Popover/index.vue @@ -10,7 +10,7 @@
diff --git a/src/libs/Popup/index.vue b/src/libs/Popup/index.vue index b6411c9..06fcbf1 100644 --- a/src/libs/Popup/index.vue +++ b/src/libs/Popup/index.vue @@ -15,7 +15,7 @@
diff --git a/src/libs/Search/index.vue b/src/libs/Search/index.vue index abbe412..2c75f10 100644 --- a/src/libs/Search/index.vue +++ b/src/libs/Search/index.vue @@ -1,6 +1,6 @@