diff --git a/yudao-ui-admin-vue3/src/App.vue b/yudao-ui-admin-vue3/src/App.vue index 8236a03e9..353c701ac 100644 --- a/yudao-ui-admin-vue3/src/App.vue +++ b/yudao-ui-admin-vue3/src/App.vue @@ -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) diff --git a/yudao-ui-admin-vue3/src/components/Setting/src/Setting.vue b/yudao-ui-admin-vue3/src/components/Setting/src/Setting.vue index f48267672..9cad96d91 100644 --- a/yudao-ui-admin-vue3/src/components/Setting/src/Setting.vue +++ b/yudao-ui-admin-vue3/src/components/Setting/src/Setting.vue @@ -3,7 +3,7 @@ import { ElDrawer, ElDivider, ElMessage } from 'element-plus' import { ref, unref, computed, watch } from 'vue' import { useCssVar, useClipboard } from '@vueuse/core' import { useI18n } from '@/hooks/web/useI18n' -import { useCache } from '@/hooks/web/useCache' +import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { useDesign } from '@/hooks/web/useDesign' import { trim, setCssVar } from '@/utils' @@ -188,9 +188,9 @@ const copyConfig = async () => { // 清空缓存 const clear = () => { const { wsCache } = useCache() - wsCache.delete('layout') - wsCache.delete('theme') - wsCache.delete('isDark') + wsCache.delete(CACHE_KEY.LAYOUT) + wsCache.delete(CACHE_KEY.THEME) + wsCache.delete(CACHE_KEY.IS_DARK) window.location.reload() } diff --git a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue index 33dd11ddd..cdce9ddf5 100644 --- a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue +++ b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue @@ -1,7 +1,7 @@