feat: add cache key

This commit is contained in:
xingyu4j
2022-12-06 16:12:54 +08:00
parent c8c6e349ae
commit 3e60ff2970
18 changed files with 100 additions and 81 deletions

View File

@ -4,7 +4,7 @@ import { isDark } from '@/utils/is'
import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign'
import { ConfigGlobal } from '@/components/ConfigGlobal'
import { useCache } from '@/hooks/web/useCache'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('app')
@ -15,8 +15,8 @@ const { wsCache } = useCache()
// 根据浏览器当前主题设置系统主题色
const setDefaultTheme = () => {
if (wsCache.get('isDark')) {
if (wsCache.get('isDark') || wsCache.get('isDark') === 'true') {
if (wsCache.get(CACHE_KEY.IS_DARK)) {
if (wsCache.get(CACHE_KEY.IS_DARK) || wsCache.get(CACHE_KEY.IS_DARK) === 'true') {
appStore.setIsDark(true)
} else {
appStore.setIsDark(false)