From f81c7614be862b872e913b37cc27a6692c8c1d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 29 Oct 2025 23:37:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(store):=20=E9=87=8D=E6=9E=84=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=97=A7=E7=9A=84=20app-store=20=E5=B9=B6=E5=BC=95?= =?UTF-8?q?=E5=85=A5=20app-store-auto-imports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 10 ++- .../components/ThemeSwitchButton.vue | 4 +- src/layouts/base-layout/base-layout-sider.vue | 2 +- src/main.ts | 4 +- src/stores/app-store-auto-imports.ts | 42 ++++++++++++ src/stores/app-store.ts | 64 ------------------- vite-plugins/02.unplugin-auto-import.ts | 2 +- vite-plugins/09.index-html-plugin.ts | 8 ++- vite-plugins/_x-demo.disabled.ts | 6 +- 9 files changed, 64 insertions(+), 78 deletions(-) create mode 100644 src/stores/app-store-auto-imports.ts delete mode 100644 src/stores/app-store.ts diff --git a/auto-imports.d.ts b/auto-imports.d.ts index f6f63aa..d90ac97 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -6,7 +6,6 @@ // biome-ignore lint: disable export {} declare global { - const APP_THEME_MODES: typeof import('./src/stores/app-store')['APP_THEME_MODES'] const ConfirmationService: typeof import('utils4u/primevue')['ConfirmationService'] const DialogService: typeof import('utils4u/primevue')['DialogService'] const EffectScope: typeof import('vue')['EffectScope'] @@ -141,7 +140,7 @@ declare global { const until: typeof import('@vueuse/core')['until'] const useActiveElement: typeof import('@vueuse/core')['useActiveElement'] const useAnimate: typeof import('@vueuse/core')['useAnimate'] - const useAppStore: typeof import('./src/stores/app-store')['useAppStore'] + const useAppStore: typeof import('./src/stores/app-store-auto-imports')['useAppStore'] const useArrayDifference: typeof import('@vueuse/core')['useArrayDifference'] const useArrayEvery: typeof import('@vueuse/core')['useArrayEvery'] const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter'] @@ -340,8 +339,8 @@ declare global { export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' import('vue') // @ts-ignore - export type { AppThemeMode } from './src/stores/app-store' - import('./src/stores/app-store') + export type { AppThemeMode } from './src/stores/app-store-auto-imports' + import('./src/stores/app-store-auto-imports') } // for vue template auto import @@ -349,7 +348,6 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface GlobalComponents {} interface ComponentCustomProperties { - readonly APP_THEME_MODES: UnwrapRef readonly ConfirmationService: UnwrapRef readonly DialogService: UnwrapRef readonly EffectScope: UnwrapRef @@ -484,7 +482,7 @@ declare module 'vue' { readonly until: UnwrapRef readonly useActiveElement: UnwrapRef readonly useAnimate: UnwrapRef - readonly useAppStore: UnwrapRef + readonly useAppStore: UnwrapRef readonly useArrayDifference: UnwrapRef readonly useArrayEvery: UnwrapRef readonly useArrayFilter: UnwrapRef diff --git a/src/layouts/base-layout/base-layout-header/components/ThemeSwitchButton.vue b/src/layouts/base-layout/base-layout-header/components/ThemeSwitchButton.vue index 216424d..bc05df4 100644 --- a/src/layouts/base-layout/base-layout-header/components/ThemeSwitchButton.vue +++ b/src/layouts/base-layout/base-layout-header/components/ThemeSwitchButton.vue @@ -4,7 +4,7 @@ const appStore = useAppStore(); const themeLabels: Record = { light: '浅色', dark: '深色', - system: '跟随系统', + auto: '跟随系统', }; @@ -12,7 +12,7 @@ const themeLabels: Record = { {{ themeLabels[appStore.themeMode] }}