lilei 3 éve
szülő
commit
c1f1b08d49
1 módosított fájl, 6 hozzáadás és 5 törlés
  1. 6 5
      src/components/MultiTab/MultiTab.vue

+ 6 - 5
src/components/MultiTab/MultiTab.vue

@@ -153,6 +153,12 @@ export default {
       console.log(newVal, oldVal)
       // 解决页面地址相同参数不同时打开多个页签问题(例 详情页id或sn不同时)
       const index = this.tabsList.indexOf(newVal.name)
+      // 是否时同一个父级菜单下的页面
+      const mnlen = newVal.matched.length < 3
+      const molen = oldVal.matched.length < 3
+      const hasChildren = newVal.matched[mnlen ? 1 : 2].name == oldVal.matched[molen ? 1 : 2].name
+      // console.log(newVal.matched[mnlen ? 1 : 2].name, oldVal.matched[molen ? 1 : 2].name, hasChildren)
+
       if (index < 0) { // 不存在
         console.log(1, '不存在')
         // 判断是否是新增,编辑,详情页
@@ -162,11 +168,6 @@ export default {
         const oa = oldVal.meta.title.indexOf('详情') >= 0
         const ob = oldVal.meta.title.indexOf('新增') >= 0
         const oc = oldVal.meta.title.indexOf('编辑') >= 0
-        // 是否时同一个父级菜单下的页面
-        const mnlen = newVal.matched.length < 3
-        const molen = oldVal.matched.length < 3
-        const hasChildren = newVal.matched[mnlen ? 1 : 2].name == oldVal.matched[molen ? 1 : 2].name
-        // console.log(newVal.matched[mnlen ? 1 : 2].name, oldVal.matched[molen ? 1 : 2].name, hasChildren)
         if ((na || nb || nc || oa || ob || oc) && hasChildren) {
           // 替换当前页签
           this.replaceTab(newVal, oldVal)