style: 使用默认布局设置
This commit is contained in:
@@ -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(() => {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user