feat:重构主题存储逻辑,优化加载背景和颜色设置

This commit is contained in:
jxxghp
2025-02-06 16:00:32 +08:00
parent 2511acfea1
commit 92a0a9fe2f
6 changed files with 24 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ import type { ThemeSwitcherTheme } from '@layouts/types'
import api from '@/api'
import { checkPrefersColorSchemeIsDark } from '@/@core/utils'
import { useToast } from 'vue-toast-notification'
import { saveLocalTheme } from '../utils/theme'
// 显示器宽度
const display = useDisplay()
@@ -102,8 +103,7 @@ function updateTheme() {
savedTheme.value = theme
themeTransition()
// 保存主题到本地
localStorage.setItem('theme', theme)
localStorage.setItem('materio-initial-loader-bg', globalTheme.current.value.colors.background)
saveLocalTheme(theme, globalTheme)
}
// 切换主题