Browse Source

修复菜单参数导致tab栏点击切换出现错误的问题

QM303176530 4 năm trước cách đây
mục cha
commit
fe326bd942
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      web/src/view/layout/aside/historyComponent/history.vue

+ 6 - 2
web/src/view/layout/aside/historyComponent/history.vue

@@ -12,6 +12,7 @@
         :key="item.name"
         :label="item.meta.title"
         :name="item.name"
+        :tab="item"
         v-for="item in historys"
       ></el-tab-pane>
     </el-tabs>
@@ -136,12 +137,15 @@ export default {
         const obj = {}
         obj.name = route.name
         obj.meta = route.meta
+        obj.query = route.query
+        obj.params = route.params
         this.historys.push(obj)
       }
       this.activeValue = this.$route.name
     },
-    changeTab(tab) {
-      this.$router.push({ name: tab.name })
+    changeTab(component) {
+      const tab = component.$attrs.tab
+      this.$router.push({ name: tab.name,query:tab.query,params:tab.params })
     },
     removeTab(tab) {
       const index = this.historys.findIndex(item => item.name == tab)