refactor(projects): 生产环境缓存主题变更为sessionStorage

This commit is contained in:
Soybean
2023-07-05 01:41:57 +08:00
parent 43ac23f113
commit c46a5920e5
5 changed files with 14 additions and 15 deletions

View File

@ -3,7 +3,7 @@ import { useOsTheme } from 'naive-ui';
import type { GlobalThemeOverrides } from 'naive-ui';
import { useElementSize } from '@vueuse/core';
import { kebabCase } from 'lodash-es';
import { localStg, getColorPalettes, getRgbOfColor } from '@/utils';
import { sessionStg, getColorPalettes, getRgbOfColor } from '@/utils';
import { useThemeStore } from '../modules';
/** 订阅theme store */
@ -19,7 +19,7 @@ export default function subscribeThemeStore() {
watch(
() => theme.themeColor,
newValue => {
localStg.set('themeColor', newValue);
sessionStg.set('themeColor', newValue);
},
{ immediate: true }
);