wangxiaoyi před 1 rokem
rodič
revize
d29bd8aa86
1 změnil soubory, kde provedl 12 přidání a 12 odebrání
  1. 12 12
      src/layout/header-aside/components/menu-header/index.js

+ 12 - 12
src/layout/header-aside/components/menu-header/index.js

@@ -27,21 +27,21 @@ export default {
         ])
         ])
     },
     },
     watch: {
     watch: {
-        $route (to, from) {
-            if (to.name === 'dashboard') {
-                this.active = ''
-            } else {
-                this.active = this.activeHeader
-            }
-        }
-        // 'activeHeader': {
-        //   handler(val) {
-        //     if(this.$route.name !== 'dashboard') {
+        // $route (to, from) {
+        //     if (to.name === 'dashboard') {
+        //         this.active = ''
+        //     } else {
         //         this.active = this.activeHeader
         //         this.active = this.activeHeader
         //     }
         //     }
-        //   },
-        //   immediate: true
         // }
         // }
+        'activeHeader': {
+            handler (val) {
+                if (this.$route.name !== 'dashboard') {
+                    this.active = this.activeHeader
+                }
+            },
+            immediate: true
+        }
         // '$route.matched': {
         // '$route.matched': {
         //   handler(val) {
         //   handler(val) {
         //     this.active = val[val.length - 1].path
         //     this.active = val[val.length - 1].path