From f6334332118fa7843432e9c069a454039d0b0831 Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期四, 19 五月 2022 14:29:30 +0800
Subject: [PATCH] 其他业务

---
 src/pages/components/showIndexTitle.vue |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/pages/components/showIndexTitle.vue b/src/pages/components/showIndexTitle.vue
index da86543..0a5c2e8 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="$route.path"
-      :class="activeStyle"
+      :default-active="activeIndex"
       router
       mode="horizontal"
       class="el-menu-demo"
@@ -61,7 +60,7 @@
             <h1>鏂囨。涓績</h1>
           </div>
         </el-menu-item>
-        <el-menu-item index="/login">
+        <el-menu-item @click="goOut">
           <div class="showIndex-block">
             <h1>閫�鍑虹櫥褰�</h1>
           </div>
@@ -74,21 +73,28 @@
 <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 {
+        activeIndex: '/index'
     }
   },
-    data() {
-      return {
-          activeStyle: false
-      }
-    },
+  mounted() {
+      this.$route.meta.routerParent && (this.activeIndex = '/' + this.$route.meta.routerParent)
+  },
   methods: {
+      goOut() {
+          this.$confirm('鏄惁閫�鍑虹郴缁�, 鏄惁缁х画?', '鎻愮ず', {
+              confirmButtonText: '纭畾',
+              cancelButtonText: '鍙栨秷',
+              type: 'warning'
+          }).then(() => {
+              this.$store.dispatch('logout').then(res => {
+                  this.$router.push('/login')
+              })
+          })
 
-  }
+      }
+  },
 };
 </script>
 

--
Gitblit v1.9.1