From 21ceff64f84fadad82078ea835e0557fce4fe604 Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Sun, 30 Nov 2025 11:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BC=98=E5=8C=96=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E9=A1=B5=E9=9D=A2=E5=88=9D=E5=A7=8B=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将adminTab计算提取为initialAdminTab变量 - healthCheck.loading和systemLogs.loading根据initialAdminTab设置初始值 - 确保data()执行时所有状态一致,避免刷新闪烁 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- frontend/app.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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,