fix(projects): fixed issue that themeStore was not reset to the initial settings when resetting it.

This commit is contained in:
zclzone 2024-05-14 18:03:55 +08:00
parent 071241f8cb
commit 35de124efb
2 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import { useEventListener, usePreferredColorScheme } from '@vueuse/core';
import { getPaletteColorByNumber } from '@sa/color'; import { getPaletteColorByNumber } from '@sa/color';
import { SetupStoreId } from '@/enum'; import { SetupStoreId } from '@/enum';
import { localStg } from '@/utils/storage'; import { localStg } from '@/utils/storage';
import { themeSettings } from '@/theme/settings';
import { import {
addThemeVarsToHtml, addThemeVarsToHtml,
createThemeToken, createThemeToken,
@ -57,8 +58,8 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
/** Reset store */ /** Reset store */
function resetStore() { function resetStore() {
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const reset = themeStore.$reset as (arg?: Partial<typeof themeSettings>) => void;
themeStore.$reset(); reset(themeSettings);
} }
/** /**

View File

@ -15,8 +15,8 @@ export function resetSetupStore(context: PiniaPluginContext) {
const defaultStore = cloneDeep($state); const defaultStore = cloneDeep($state);
context.store.$reset = () => { context.store.$reset = (state?: Partial<typeof defaultStore>) => {
context.store.$patch(defaultStore); context.store.$patch(state || defaultStore);
}; };
} }
} }