From b16e8cb3f625b40ba176758297ffab016e664603 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期三, 30 三月 2022 10:34:40 +0800
Subject: [PATCH] topNav自定义隐藏侧边栏路由

---
 src/components/TopNav/index.vue |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue
index 853e48f..e3e5c97 100644
--- a/src/components/TopNav/index.vue
+++ b/src/components/TopNav/index.vue
@@ -33,10 +33,10 @@
 
 // 椤堕儴鏍忓垵濮嬫暟
 const visibleNumber = ref(null);
-// 鏄惁涓洪娆″姞杞�
-const isFrist = ref(null);
 // 褰撳墠婵�娲昏彍鍗曠殑 index
 const currentIndex = ref(null);
+// 闅愯棌渚ц竟鏍忚矾鐢�
+const hideList = ['/index', '/user/profile'];
 
 const store = useStore();
 const route = useRoute();
@@ -88,17 +88,10 @@
 const activeMenu = computed(() => {
   const path = route.path;
   let activePath = path;
-  if (path !== undefined && 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("/"));
     store.dispatch('app/toggleSideBarHide', false);
-  } else if ("/index" == path || "" == path) {
-    if (!isFrist.value) {
-      isFrist.value = true;
-    } else {
-      activePath = "index";
-    }
-    store.dispatch('app/toggleSideBarHide', true);
   } else if(!route.children) {
     activePath = path;
     store.dispatch('app/toggleSideBarHide', true);

--
Gitblit v1.9.3