Browse Source

问题修改

SunZehao 2 years ago
parent
commit
9f904e77c8
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/views/homePage.vue

+ 6 - 4
src/views/homePage.vue

@@ -336,13 +336,14 @@ export default {
             })
         },
         handleNodeClick(index, indexPath) {
+            let tagsArr = []
             if (indexPath) {
                 this.forecastDatas.forEach(it =>{
                     if (it.index !== '') {
                         if (it.index === indexPath[0]) {
                             if (!it.children) {
                                 let showM = 0
-                                this.routeTags.forEach(item =>{
+                                tagsArr.forEach(item =>{
                                     if (item.name === it.name) {
                                         showM++
                                     }
@@ -352,20 +353,20 @@ export default {
                                         index: it.index,
                                         name: it.name
                                     }
-                                    this.routeTags.push(obj)
+                                    tagsArr.push(obj)
                                 }
                             } else {
                                 it.children.forEach(iv =>{
                                     if (iv.index !== '') {
                                         if (iv.index === indexPath[1]) {
                                             let showM = 0
-                                            this.routeTags.forEach(item =>{
+                                            tagsArr.forEach(item =>{
                                                 if (item.name === iv.name) {
                                                     showM++
                                                 }
                                             })
                                             if (showM === 0) {
-                                                this.routeTags.push(iv)
+                                                tagsArr.push(iv)
                                             }
                                         }
                                     }
@@ -374,6 +375,7 @@ export default {
                         }
                     }
                 })
+                this.routeTags = tagsArr.concat(this.routeTags)
                 window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
             }
         },