mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-29 22:56:41 +08:00
fix(projects): fixed issue that themeStore was not reset to the initial settings when resetting it.
This commit is contained in:
parent
071241f8cb
commit
35de124efb
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user