mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 08:06:43 +08:00
fix: prevent theme customizer startup crash
This commit is contained in:
@@ -34,7 +34,6 @@ const validLayouts: ThemeCustomizerLayout[] = ['vertical', 'collapsed', 'horizon
|
|||||||
const validSkins: ThemeCustomizerSkin[] = ['default', 'bordered']
|
const validSkins: ThemeCustomizerSkin[] = ['default', 'bordered']
|
||||||
const validThemes: ThemeCustomizerTheme[] = ['auto', 'light', 'dark', 'purple', 'transparent']
|
const validThemes: ThemeCustomizerTheme[] = ['auto', 'light', 'dark', 'purple', 'transparent']
|
||||||
|
|
||||||
const settingsState = ref<ThemeCustomizerSettings>(readThemeCustomizerSettings())
|
|
||||||
let themeApplyVersion = 0
|
let themeApplyVersion = 0
|
||||||
|
|
||||||
function isBrowser() {
|
function isBrowser() {
|
||||||
@@ -101,6 +100,9 @@ export function readThemeCustomizerSettings(): ThemeCustomizerSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生产构建会改写导出函数的声明形式,状态初始化必须放在读取函数定义之后,避免首屏执行时引用未完成赋值的函数。
|
||||||
|
const settingsState = ref<ThemeCustomizerSettings>(readThemeCustomizerSettings())
|
||||||
|
|
||||||
function persistThemeCustomizerSettings(settings: ThemeCustomizerSettings) {
|
function persistThemeCustomizerSettings(settings: ThemeCustomizerSettings) {
|
||||||
if (!isBrowser()) return
|
if (!isBrowser()) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user