mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-13 13:23:42 +08:00
refactor(projects): 去除在pinia的getters的函数调用副作用,用watch代替
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { GlobalThemeOverrides } from 'naive-ui';
|
||||
import { cloneDeep, kebabCase } from 'lodash-es';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { themeSetting } from '@/settings';
|
||||
import { getThemeColor, getColorPalette, addColorAlpha } from '@/utils';
|
||||
|
||||
@@ -72,20 +72,6 @@ export function getNaiveThemeOverrides(colors: Record<ColorType, string>): Globa
|
||||
};
|
||||
}
|
||||
|
||||
type ThemeVars = Exclude<GlobalThemeOverrides['common'], undefined>;
|
||||
type ThemeVarsKeys = keyof ThemeVars;
|
||||
|
||||
/** 添加css vars至html */
|
||||
export function addThemeCssVarsToHtml(themeVars: ThemeVars) {
|
||||
const keys = Object.keys(themeVars) as ThemeVarsKeys[];
|
||||
const style: string[] = [];
|
||||
keys.forEach(key => {
|
||||
style.push(`--${kebabCase(key)}: ${themeVars[key]}`);
|
||||
});
|
||||
const styleStr = style.join(';');
|
||||
document.documentElement.style.cssText += styleStr;
|
||||
}
|
||||
|
||||
/** windicss 暗黑模式 */
|
||||
export function handleWindicssDarkMode() {
|
||||
const DARK_CLASS = 'dark';
|
||||
|
Reference in New Issue
Block a user