20251205优化数据请求逻辑
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
background-color="#E8F5E9"
|
background-color="#E8F5E9"
|
||||||
text-color="#2E7D32"
|
text-color="#2E7D32"
|
||||||
active-text-color="#1B5E20"
|
active-text-color="#1B5E20"
|
||||||
router
|
@select="handleMenuSelect"
|
||||||
>
|
>
|
||||||
<template v-for="item in menu">
|
<template v-for="item in menu">
|
||||||
<el-submenu
|
<el-submenu
|
||||||
@@ -80,6 +80,22 @@ export default {
|
|||||||
myname: myname,
|
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() {
|
mounted() {
|
||||||
if (sessionStorage.getItem("access-user") == "Leader") {
|
if (sessionStorage.getItem("access-user") == "Leader") {
|
||||||
this.menu = [
|
this.menu = [
|
||||||
|
|||||||
Reference in New Issue
Block a user