20251205优化数据请求逻辑

This commit is contained in:
wxlong
2025-12-05 11:12:10 +08:00
parent 7140e63b3f
commit b10c88dbd7

View File

@@ -34,7 +34,7 @@
background-color="#E8F5E9"
text-color="#2E7D32"
active-text-color="#1B5E20"
router
@select="handleMenuSelect"
>
<template v-for="item in menu">
<el-submenu
@@ -80,6 +80,22 @@ export default {
myname: myname,
};
},
methods: {
// 处理菜单选择,避免重复导航
handleMenuSelect(index) {
// 如果点击的是当前路径,阻止导航
if (this.$route.path === index) {
return false;
}
// 否则正常导航
this.$router.push({ path: index }).catch(err => {
// 忽略 NavigationDuplicated 错误
if (err.name !== 'NavigationDuplicated') {
console.error('路由导航错误:', err);
}
});
}
},
mounted() {
if (sessionStorage.getItem("access-user") == "Leader") {
this.menu = [