解决提示框遮挡问题,优化UserManagement和HeaderBar布局,导航栏重复点击警告,退出跳转页面的优化

This commit is contained in:
Ran_Chen
2025-04-03 15:44:41 +08:00
parent ad0493f8a0
commit 7550ac327e
9 changed files with 267 additions and 328 deletions
+14
View File
@@ -76,6 +76,20 @@ const router = new VueRouter({
routes
})
// 全局处理重复导航,改为刷新页面
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => {
if (err.name === 'NavigationDuplicated') {
// 如果是重复导航,刷新页面
window.location.reload()
} else {
// 其他错误正常抛出
throw err
}
})
}
// 需要登录才能访问的路由
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig']