This commit is contained in:
张成
2025-10-08 19:30:09 +08:00
parent 7e888970d3
commit 99f73eff84
6 changed files with 1339 additions and 3 deletions

View File

@@ -95,7 +95,15 @@ export default {
this.collapsed = collapsed
},
goHome() {
this.$router.push({ path: '/' })
// 避免重复导航到当前页面
if (this.$route.path !== '/' && this.$route.path !== '/home') {
this.$router.push({ path: '/' }).catch(err => {
// 忽略重复导航错误
if (err.name !== 'NavigationDuplicated') {
console.error(err)
}
})
}
},
turnToPage(route) {
let { name, params, query } = {}
@@ -109,10 +117,21 @@ export default {
window.open(name.split('_')[1])
return
}
// 避免重复导航到当前页面
if (this.$route.name === name) {
return
}
this.$router.push({
name,
params,
query
}).catch(err => {
// 忽略重复导航错误
if (err.name !== 'NavigationDuplicated') {
console.error(err)
}
})
},
handleCollapsedChange(state) {