20251205优化数据请求逻辑

This commit is contained in:
wxlong
2025-12-05 11:12:10 +08:00
parent 7140e63b3f
commit c4c36028d3
7 changed files with 92 additions and 192 deletions

View File

@@ -11,7 +11,7 @@
text-color="#2E7D32"
active-text-color="#1B5E20"
:default-active="this.$route.path"
router
@select="handleMenuSelect"
>
<el-submenu index="1">
<template slot="title">
@@ -44,7 +44,22 @@ export default {
data() {
return {};
},
method: {},
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);
}
});
}
},
};
</script>
<style scoped>