2
0

style: 使用默认布局设置

This commit is contained in:
TsMask
2025-02-27 11:57:14 +08:00
parent d25c9b1ef4
commit 2ab8b3bb9b
2 changed files with 13 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import { computed, effectScope, onScopeDispose, ref, toRefs, watch } from 'vue'; import { computed, effectScope, onScopeDispose, ref, toRefs, watch } from 'vue';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { useEventListener, usePreferredColorScheme } from '@vueuse/core'; import { usePreferredColorScheme } from '@vueuse/core';
import { SetupStoreId } from '@/enum'; import { SetupStoreId } from '@/enum';
import { localStg } from '@/utils/storage'; import { localStg } from '@/utils/storage';
import { addThemeVarsToHtml, createThemeToken, getAntdTheme, initThemeSettings, toggleCssDarkMode } from './shared'; import { addThemeVarsToHtml, createThemeToken, getAntdTheme, initThemeSettings, toggleCssDarkMode } from './shared';
@@ -102,18 +102,18 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
} }
/** Cache theme settings */ /** Cache theme settings */
function cacheThemeSettings() { // function cacheThemeSettings() {
const isProd = import.meta.env.PROD; // const isProd = import.meta.env.PROD;
//
if (!isProd) return; // if (!isProd) return;
//
localStg.set('themeSettings', settings.value); // localStg.set('themeSettings', settings.value);
} // }
// cache theme settings when page is closed or refreshed // cache theme settings when page is closed or refreshed
useEventListener(window, 'beforeunload', () => { // useEventListener(window, 'beforeunload', () => {
cacheThemeSettings(); // cacheThemeSettings();
}); // });
// watch store // watch store
scope.run(() => { scope.run(() => {

View File

@@ -10,6 +10,8 @@ const DARK_CLASS = 'dark';
/** Init theme settings */ /** Init theme settings */
export function initThemeSettings() { export function initThemeSettings() {
return themeSettings; // 直接使用默认设置 src/store/modules/theme/index.ts 注释104行Cache theme settings相关
const isProd = import.meta.env.PROD; const isProd = import.meta.env.PROD;
// if it is development mode, the theme settings will not be cached, by update `themeSettings` in `src/theme/settings.ts` to update theme settings // if it is development mode, the theme settings will not be cached, by update `themeSettings` in `src/theme/settings.ts` to update theme settings