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 { SetupStoreId } from '@/enum';
import { localStg } from '@/utils/storage';
import { themeSettings } from '@/theme/settings';
import {
addThemeVarsToHtml,
createThemeToken,
@ -57,8 +58,8 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
/** Reset store */
function resetStore() {
const themeStore = useThemeStore();
themeStore.$reset();
const reset = themeStore.$reset as (arg?: Partial<typeof themeSettings>) => void;
reset(themeSettings);
}
/**

View File

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