From 5ca9bd6876a376c1c2fc4cdc2cf9bbcf7d4684bc Mon Sep 17 00:00:00 2001
From: 若依 <yzz_ivy@163.com>
Date: Fri, 17 Mar 2023 14:11:24 +0800
Subject: [PATCH] !673 $tab.closePage后存在非首页页签时不应该跳转首页 Merge pull request !673 from Giovanni/master
---
ruoyi-ui/src/components/TopNav/index.vue | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue
index cabb258..5f0edbe 100644
--- a/ruoyi-ui/src/components/TopNav/index.vue
+++ b/ruoyi-ui/src/components/TopNav/index.vue
@@ -30,13 +30,14 @@
<script>
import { constantRoutes } from "@/router";
+// 隐藏侧边栏路由
+const hideList = ['/index', '/user/profile'];
+
export default {
data() {
return {
// 顶部栏初始数
visibleNumber: 5,
- // 是否为首次加载
- isFrist: false,
// 当前激活菜单的 index
currentIndex: undefined
};
@@ -88,17 +89,12 @@
activeMenu() {
const path = this.$route.path;
let activePath = path;
- if (path.lastIndexOf("/") > 0) {
+ if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) {
const tmpPath = path.substring(1, path.length);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
- this.$store.dispatch('app/toggleSideBarHide', false);
- } else if ("/index" == path || "" == path) {
- if (!this.isFrist) {
- this.isFrist = true;
- } else {
- activePath = "index";
+ if (!this.$route.meta.link) {
+ this.$store.dispatch('app/toggleSideBarHide', false);
}
- this.$store.dispatch('app/toggleSideBarHide', true);
} else if(!this.$route.children) {
activePath = path;
this.$store.dispatch('app/toggleSideBarHide', true);
@@ -151,6 +147,8 @@
}
if(routes.length > 0) {
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
+ } else {
+ this.$store.dispatch('app/toggleSideBarHide', true);
}
},
ishttp(url) {
--
Gitblit v1.9.2