mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
optimize(projects): use defu
to fill added theme config
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import type { GlobalThemeOverrides } from 'naive-ui';
|
||||
import { defu } from 'defu';
|
||||
import { addColorAlpha, getColorPalette, getPaletteColorByNumber, getRgb } from '@sa/color';
|
||||
import { overrideThemeSettings, themeSettings } from '@/theme/settings';
|
||||
import { themeVars } from '@/theme/vars';
|
||||
@ -17,12 +18,15 @@ export function initThemeSettings() {
|
||||
// if it is production mode, the theme settings will be cached in localStorage
|
||||
// if want to update theme settings when publish new version, please update `overrideThemeSettings` in `src/theme/settings.ts`
|
||||
|
||||
const settings = localStg.get('themeSettings') || themeSettings;
|
||||
const localSettings = localStg.get('themeSettings');
|
||||
|
||||
let settings = defu(localSettings, themeSettings);
|
||||
|
||||
const isOverride = localStg.get('overrideThemeFlag') === BUILD_TIME;
|
||||
|
||||
if (!isOverride) {
|
||||
Object.assign(settings, overrideThemeSettings);
|
||||
settings = defu(overrideThemeSettings, settings);
|
||||
|
||||
localStg.set('overrideThemeFlag', BUILD_TIME);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user