|
@@ -121,15 +121,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- '$route': function (newVal) {
|
|
|
+ '$route': function (newVal, oldVal) {
|
|
|
+ // 父页面(列表)进入子页面(编辑、详情)再返回至子页面时关闭子页面页签
|
|
|
+ if (oldVal && oldVal.name && newVal.query.closeLastOldTab) {
|
|
|
+ this.remove(oldVal.name) // 关闭子页面
|
|
|
+ }
|
|
|
this.activeKey = newVal.name
|
|
|
const index = this.tabsList.indexOf(newVal.name)
|
|
|
- // 不存在
|
|
|
- if (index < 0) {
|
|
|
+ // 解决页面地址相同参数不同时打开多个页签问题(例 详情页id或sn不同时)
|
|
|
+ if (index < 0) { // 不存在
|
|
|
this.tabsList.push(newVal.name)
|
|
|
this.pages.push(newVal)
|
|
|
- } else {
|
|
|
- // 已存在
|
|
|
+ } else { // 已存在
|
|
|
this.pages.splice(index, 1, newVal)
|
|
|
}
|
|
|
},
|