From a3abdf4cb6ea6ba057da0ae1b6af15497dbe2044 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123456 <zxx19900626>
Date: 星期一, 18 四月 2022 14:27:01 +0800
Subject: [PATCH] 路由跳转

---
 src/router/router.js                    |    8 ++++----
 src/pages/components/showIndexTitle.vue |   22 +++++++++-------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/pages/components/showIndexTitle.vue b/src/pages/components/showIndexTitle.vue
index 65a74d7..cd1946d 100644
--- a/src/pages/components/showIndexTitle.vue
+++ b/src/pages/components/showIndexTitle.vue
@@ -2,8 +2,7 @@
   <div class="showIndexTitle-wrap">
     <h1 class="title">鐭冲搴勪汉绀惧眬涓氬姟杩愯鏁版嵁鍒嗘瀽骞冲彴</h1>
     <el-menu
-      default-active="/index"
-      :class="activeStyle"
+      :default-active="activeIndex"
       router
       mode="horizontal"
       class="el-menu-demo"
@@ -75,21 +74,18 @@
 <script>
 export default {
   name: "showIndexTitle",
-  watch: {
-    '$route' (toRouter, fromRouter) {
-        console.log(toRouter,'toRouter')
-        console.log(fromRouter,'fromRouter')
-        console.log('$route.path---',this.$route)
+  data() {
+    return {
+        activeStyle: false,
+        activeIndex: '/index'
     }
   },
-    data() {
-      return {
-          activeStyle: false
-      }
-    },
+  mounted() {
+      this.$route.meta.routerParent && (this.activeIndex = '/' + this.$route.meta.routerParent)
+  },
   methods: {
 
-  }
+  },
 };
 </script>
 
diff --git a/src/router/router.js b/src/router/router.js
index 469a16e..7774c46 100644
--- a/src/router/router.js
+++ b/src/router/router.js
@@ -167,7 +167,7 @@
       children:[
         {
           path: "/personnelTalents_unitPersonnel",
-          meta: {title: "浜嬩笟鍗曚綅浜哄憳鎯呭喌"},
+          meta: {title: "浜嬩笟鍗曚綅浜哄憳鎯呭喌", routerParent: 'personnelTalents'},
           name: "/PersonnelTalents_unitPersonnel",
           component: () =>
             import(
@@ -176,7 +176,7 @@
         },
         {
           path: "/personnelTalents_greenCard",
-          meta: {title: "浜烘墠缁垮崱琛ヨ创"},
+          meta: {title: "浜烘墠缁垮崱琛ヨ创", routerParent: 'personnelTalents'},
           name: "/PersonnelTalents_GreenCard",
           component: () =>
             import(
@@ -200,7 +200,7 @@
       children: [
         {
           path: "/otherB-PeopleJunShouRu",
-          meta: {title: "灞呮皯浜哄眳鏀跺叆銆佸彲鏀厤鏀跺叆"},
+          meta: {title: "灞呮皯浜哄眳鏀跺叆銆佸彲鏀厤鏀跺叆", routerParent: 'OtherBusiness'},
           name: "otherB-PeopleJunShouRu",
           component: () =>
             import(
@@ -209,7 +209,7 @@
         },
         {
           path: "/otherB-GongGuTuoPin",
-          meta: {title: "灞呮皯浜哄眳鏀跺叆銆佸彲鏀厤鏀跺叆"},
+          meta: {title: "灞呮皯浜哄眳鏀跺叆銆佸彲鏀厤鏀跺叆", routerParent: 'OtherBusiness'},
           name: "otherB-GongGuTuoPin",
           component: () =>
             import(

--
Gitblit v1.9.1