Kaynağa Gözat

左侧菜单修改样式

SunZehao 5 gün önce
ebeveyn
işleme
36a7c2ae03
1 değiştirilmiş dosya ile 11 ekleme ve 3 silme
  1. 11 3
      src/App.vue

+ 11 - 3
src/App.vue

@@ -79,6 +79,7 @@
                 v-for="(menuitem, index) in menu.children"
                 :key="index"
                 class="elsubMenu"
+                :class="getSelectState(menuitem.index)"
               >
                 <el-menu-item :index="menuitem.index" class="grounpItem">
                   <!-- <span class="grounpItemSty"></span> -->
@@ -627,14 +628,15 @@ export default {
     console.log("离开标记", this.socketLeaveFlag);
   },
   methods: {
-    getSelectState() {
-      // routepath === $route.path ? 'isSelect' : ''
+    getSelectState(idx) {
+    //   routepath === $route.path ? 'isSelect' : ''
       const href = window.location.href;
       const path = this.$route.path;
 
       const reg = new RegExp(path);
 
-      return path !== "/" && reg.test(href) ? "isSelect" : "";
+    //   return idx !== "/" && reg.test(path) ? "isSelect" : "";
+      return idx !== "/" && path.indexOf(idx) !== -1 ? "isSelect" : "";
     },
     initMenu() {
       let str = window.location.href;
@@ -1324,6 +1326,12 @@ body {
             //   }
             // }
           }
+          .isSelect{
+            background: #1c69bb;
+            .grounpItemSpan{
+                color: #a5b7df;
+            }
+          }
         }
       }