From 3acee68ab9c73d1c81653a68094b5316f19c867d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 12 Dec 2025 19:13:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=20wot=20?= =?UTF-8?q?=E9=9B=86=E6=88=90=EF=BC=88=E9=A2=9D=E5=A4=96=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E5=8F=82=E8=80=83=20unibest=203.X=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.config.ts | 4 ++-- src/App.ku.vue | 9 +++++++-- src/store/theme.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ src/tabbar/index.vue | 4 ++-- vite.config.ts | 15 ++++++++++++++- 5 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 src/store/theme.ts diff --git a/pages.config.ts b/pages.config.ts index 7a9edb3..abb0a92 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -4,7 +4,7 @@ import { tabBar } from './src/tabbar/config' export default defineUniPages({ globalStyle: { navigationStyle: 'default', - navigationBarTitleText: 'unibest', + navigationBarTitleText: '芋道管理系统', navigationBarBackgroundColor: '#f8f8f8', navigationBarTextStyle: 'black', backgroundColor: '#FFFFFF', @@ -13,9 +13,9 @@ export default defineUniPages({ autoscan: true, custom: { '^fg-(.*)': '@/components/fg-$1/fg-$1.vue', + '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue', '^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)': 'z-paging/components/z-paging$1/z-paging$1.vue', - '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue', }, }, // tabbar 的配置统一在 “./src/tabbar/config.ts” 文件中 diff --git a/src/App.ku.vue b/src/App.ku.vue index f157361..8aab489 100644 --- a/src/App.ku.vue +++ b/src/App.ku.vue @@ -1,9 +1,12 @@ diff --git a/src/store/theme.ts b/src/store/theme.ts new file mode 100644 index 0000000..c3f1c55 --- /dev/null +++ b/src/store/theme.ts @@ -0,0 +1,42 @@ +import type { ConfigProviderThemeVars } from 'wot-design-uni' + +import { defineStore } from 'pinia' + +export const useThemeStore = defineStore( + 'theme-store', + () => { + /** 主题 */ + const theme = ref<'light' | 'dark'>('light') + + /** 主题变量 */ + const themeVars = ref({ + // colorTheme: 'red', + // buttonPrimaryBgColor: '#07c160', + // buttonPrimaryColor: '#07c160', + }) + + /** 设置主题变量 */ + const setThemeVars = (partialVars: Partial) => { + themeVars.value = { ...themeVars.value, ...partialVars } + } + + /** 切换主题 */ + const toggleTheme = () => { + theme.value = theme.value === 'light' ? 'dark' : 'light' + } + + return { + /** 设置主题变量 */ + setThemeVars, + /** 切换主题 */ + toggleTheme, + /** 主题变量 */ + themeVars, + /** 主题 */ + theme, + } + }, + { + persist: true, + }, +) diff --git a/src/tabbar/index.vue b/src/tabbar/index.vue index 20f2f10..eca89bd 100644 --- a/src/tabbar/index.vue +++ b/src/tabbar/index.vue @@ -108,7 +108,7 @@ function getImageByIndex(index: number, item: CustomTabBarItem) { - +