mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
build(projects): update tsconfig、eslintrc
This commit is contained in:
@ -26,17 +26,17 @@ interface ColorAction {
|
||||
/** 获取主题颜色的各种场景对应的颜色 */
|
||||
function getThemeColors(colors: [ColorType, string][]) {
|
||||
const colorActions: ColorAction[] = [
|
||||
{ scene: '', handler: color => color },
|
||||
{ scene: 'Suppl', handler: color => color },
|
||||
{ scene: 'Hover', handler: color => getColorPalette(color, 5) },
|
||||
{ scene: 'Pressed', handler: color => getColorPalette(color, 7) },
|
||||
{ scene: 'Active', handler: color => addColorAlpha(color, 0.1) }
|
||||
{ scene: '', handler: (color) => color },
|
||||
{ scene: 'Suppl', handler: (color) => color },
|
||||
{ scene: 'Hover', handler: (color) => getColorPalette(color, 5) },
|
||||
{ scene: 'Pressed', handler: (color) => getColorPalette(color, 7) },
|
||||
{ scene: 'Active', handler: (color) => addColorAlpha(color, 0.1) },
|
||||
];
|
||||
|
||||
const themeColor: ThemeColor = {};
|
||||
|
||||
colors.forEach(color => {
|
||||
colorActions.forEach(action => {
|
||||
colors.forEach((color) => {
|
||||
colorActions.forEach((action) => {
|
||||
const [colorType, colorValue] = color;
|
||||
const colorKey: ColorKey = `${colorType}Color${action.scene}`;
|
||||
themeColor[colorKey] = action.handler(colorValue);
|
||||
@ -57,18 +57,18 @@ export function getNaiveThemeOverrides(colors: Record<ColorType, string>): Globa
|
||||
['info', info],
|
||||
['success', success],
|
||||
['warning', warning],
|
||||
['error', error]
|
||||
['error', error],
|
||||
]);
|
||||
|
||||
const colorLoading = primary;
|
||||
|
||||
return {
|
||||
common: {
|
||||
...themeColors
|
||||
...themeColors,
|
||||
},
|
||||
LoadingBar: {
|
||||
colorLoading
|
||||
}
|
||||
colorLoading,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ type ThemeVarsKeys = keyof ThemeVars;
|
||||
export function addThemeCssVarsToHtml(themeVars: ThemeVars) {
|
||||
const keys = Object.keys(themeVars) as ThemeVarsKeys[];
|
||||
const style: string[] = [];
|
||||
keys.forEach(key => {
|
||||
keys.forEach((key) => {
|
||||
style.push(`--${kebabCase(key)}: ${themeVars[key]}`);
|
||||
});
|
||||
const styleStr = style.join(';');
|
||||
@ -97,6 +97,6 @@ export function handleWindicssDarkMode() {
|
||||
}
|
||||
return {
|
||||
addDarkClass,
|
||||
removeDarkClass
|
||||
removeDarkClass,
|
||||
};
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import type {
|
||||
ThemeLayoutMode,
|
||||
ThemeTabMode,
|
||||
ThemeHorizontalMenuPosition,
|
||||
ThemeAnimateMode
|
||||
ThemeAnimateMode,
|
||||
} from '@/interface';
|
||||
import { getThemeSettings, getNaiveThemeOverrides, addThemeCssVarsToHtml } from './helpers';
|
||||
|
||||
@ -17,13 +17,15 @@ export const useThemeStore = defineStore('theme-store', {
|
||||
/** naiveUI的主题配置 */
|
||||
naiveThemeOverrides(state) {
|
||||
const overrides = getNaiveThemeOverrides({ primary: state.themeColor, ...state.otherColor });
|
||||
addThemeCssVarsToHtml(overrides.common!);
|
||||
if (overrides.common) {
|
||||
addThemeCssVarsToHtml(overrides.common);
|
||||
}
|
||||
return overrides;
|
||||
},
|
||||
/** naive-ui暗黑主题 */
|
||||
naiveTheme(state) {
|
||||
return state.darkMode ? darkTheme : undefined;
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
/** 重置theme状态 */
|
||||
@ -133,6 +135,6 @@ export const useThemeStore = defineStore('theme-store', {
|
||||
/** 设置页面过渡动画类型 */
|
||||
setPageAnimateMode(mode: ThemeAnimateMode) {
|
||||
this.page.animateMode = mode;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user