|
@@ -143,14 +143,8 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
'$route': function (newVal, oldVal) {
|
|
|
- // 父页面(列表)进入子页面(编辑、详情)再返回至父页面时关闭子页面页签 子页面点击“返回列表”
|
|
|
- if (oldVal && oldVal.name && newVal.query.closeLastOldTab) {
|
|
|
- if (oldVal.name.indexOf('List') == -1) { // 要关闭的页面不能是列表页
|
|
|
- this.remove(oldVal.name) // 关闭子页面
|
|
|
- }
|
|
|
- }
|
|
|
- this.activeKey = newVal.name
|
|
|
const index = this.tabsList.indexOf(newVal.name)
|
|
|
+ if (newVal.name == oldVal.name) { return }
|
|
|
// 解决页面地址相同参数不同时打开多个页签问题(例 详情页id或sn不同时)
|
|
|
if (index < 0) { // 不存在
|
|
|
this.tabsList.push(newVal.name)
|
|
@@ -160,8 +154,17 @@ export default {
|
|
|
this.pages.splice(index, 1, newVal)
|
|
|
this.$store.state.app.isNewTab = false
|
|
|
}
|
|
|
+ // 父页面(列表)进入子页面(编辑、详情)再返回至父页面时关闭子页面页签 子页面点击“返回列表”
|
|
|
+ if (oldVal && oldVal.name && newVal.query.closeLastOldTab) {
|
|
|
+ if (oldVal.name.indexOf('List') == -1) { // 要关闭的页面不能是列表页
|
|
|
+ this.remove(oldVal.name) // 关闭子页面
|
|
|
+ this.$store.state.app.isNewTab = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.activeKey = newVal.name
|
|
|
},
|
|
|
activeKey: function (newPathKey) {
|
|
|
+ console.log(newPathKey, 'newVal')
|
|
|
const row = this.pages.find(item => item.name == newPathKey)
|
|
|
if (row.fullPath.indexOf('/list') == -1) {
|
|
|
this.$router.push({ path: row.fullPath })
|