Browse Source

Merge branch 'master' into japan

jinx 3 years ago
parent
commit
f182f12db1
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/page/layout/slide.vue

+ 12 - 1
src/page/layout/slide.vue

@@ -3,7 +3,7 @@
     <div class="navigator_menu">
       <span>导航面板</span>
     </div>
-    <el-menu text-color="#999" active-text-color="#333" class="el-menu-vertical-demo" @select='handleSelect'>
+    <el-menu text-color="#999"  :default-active="actice_idx" active-text-color="#333" class="el-menu-vertical-demo" @select='handleSelect'>
       <template v-for="(nav, i) in navs">
 
         <router-link tag="div" :to="nav.link" :key="i" v-if="!nav.children">
@@ -116,6 +116,17 @@ export default {
       navs: navs
     }
   },
+  mounted () {
+    let index = this.navs.findIndex((i) => {
+      console.log(i.link.name, this.$route.name)
+      return i.link.name === this.$route.name
+    })
+    console.log(index)
+
+    if (index !== -1) {
+      this.actice_idx = index.toString()
+    }
+  },
   methods: {
     handleSelect (key) {
       console.log(key)