Przeglądaj źródła

topNav自定义隐藏侧边栏路由

RuoYi 4 lat temu
rodzic
commit
a70d5ee2ab

+ 4 - 10
ruoyi-ui/src/components/TopNav/index.vue

@@ -30,13 +30,14 @@
30 30
 <script>
31 31
 import { constantRoutes } from "@/router";
32 32
 
33
+// 隐藏侧边栏路由
34
+const hideList = ['/index', '/user/profile'];
35
+
33 36
 export default {
34 37
   data() {
35 38
     return {
36 39
       // 顶部栏初始数
37 40
       visibleNumber: 5,
38
-      // 是否为首次加载
39
-      isFrist: false,
40 41
       // 当前激活菜单的 index
41 42
       currentIndex: undefined
42 43
     };
@@ -88,17 +89,10 @@ export default {
88 89
     activeMenu() {
89 90
       const path = this.$route.path;
90 91
       let activePath = path;
91
-      if (path.lastIndexOf("/") > 0) {
92
+      if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) {
92 93
         const tmpPath = path.substring(1, path.length);
93 94
         activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
94 95
         this.$store.dispatch('app/toggleSideBarHide', false);
95
-      } else if ("/index" == path || "" == path) {
96
-        if (!this.isFrist) {
97
-          this.isFrist = true;
98
-        } else {
99
-          activePath = "index";
100
-        }
101
-        this.$store.dispatch('app/toggleSideBarHide', true);
102 96
       } else if(!this.$route.children) {
103 97
         activePath = path;
104 98
         this.$store.dispatch('app/toggleSideBarHide', true);

+ 1 - 1
ruoyi-ui/src/layout/index.vue

@@ -102,7 +102,7 @@ export default {
102 102
   }
103 103
 
104 104
   .sidebarHide .fixed-header {
105
-    width: calc(100%);
105
+    width: 100%;
106 106
   }
107 107
 
108 108
   .mobile .fixed-header {