diff --git a/frontend/app.js b/frontend/app.js index f3c2a06..3668d3c 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -2,6 +2,12 @@ const { createApp } = Vue; createApp({ data() { + // 预先确定管理员标签页,避免刷新时状态丢失导致闪烁 + const initialAdminTab = (() => { + const saved = localStorage.getItem('adminTab'); + return (saved && ['overview', 'settings', 'monitor', 'users', 'tools'].includes(saved)) ? saved : 'overview'; + })(); + return { // API配置 // API配置 - 通过nginx代理访问 @@ -22,11 +28,7 @@ createApp({ fileViewMode: 'grid', // 文件显示模式: grid 大图标, list 列表 shareViewMode: 'list', // 分享显示模式: grid 大图标, list 列表 debugMode: false, // 调试模式(管理员可切换) - adminTab: (() => { - // 从localStorage恢复管理员标签页(防止刷新时UI闪烁) - const saved = localStorage.getItem('adminTab'); - return (saved && ['overview', 'settings', 'monitor', 'users', 'tools'].includes(saved)) ? saved : 'overview'; - })(), // 管理员页面当前标签:overview, settings, monitor, users, tools + adminTab: initialAdminTab, // 管理员页面当前标签:overview, settings, monitor, users, tools // 表单数据 loginForm: { @@ -165,7 +167,7 @@ createApp({ // 健康检测 healthCheck: { - loading: false, + loading: initialAdminTab === 'monitor', lastCheck: null, overallStatus: null, // healthy, warning, critical summary: { total: 0, pass: 0, warning: 0, fail: 0, info: 0 }, @@ -174,7 +176,7 @@ createApp({ // 系统日志 systemLogs: { - loading: false, + loading: initialAdminTab === 'monitor', logs: [], total: 0, page: 1,