Browse Source

器件选型选择隐藏

yangc 7 years ago
parent
commit
b077125c4b
1 changed files with 10 additions and 1 deletions
  1. 10 1
      components/home/KindCategory.vue

+ 10 - 1
components/home/KindCategory.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="kind-category" @mouseleave="hideChildrenLayout()">
+  <div class="kind-category" ref="kindCategory" @mouseleave="hideChildrenLayout()">
     <ul class="kind-main list-unstyled">
       <li v-for="kind in kindsToShow" class="kind-main-item" :class="{active: kind.id==activeKindId}"
         @mouseenter="showChildrenLayout(kind)">
@@ -66,6 +66,15 @@
         this.activeKindId = null
       }
     },
+    watch: {
+      '$route.path': {
+        handler: function (path) {
+          if (path !== '/') {
+            this.$refs.kindCategory.style.display = 'none'
+          }
+        }
+      }
+    },
 //    mounted () {
 //      this.$http.get(`/api/product/kind/0/children_all`)
 //        .then(response => {