|
@@ -26,7 +26,7 @@ export default {
|
|
|
}
|
|
|
this.closeThat(val)
|
|
|
}).$on('rename', ({ key, name }) => {
|
|
|
- console.log('rename', key, name)
|
|
|
+ // console.log('rename', key, name)
|
|
|
try {
|
|
|
const item = this.pages.find(item => item.path === key)
|
|
|
item.meta.customTitle = name
|
|
@@ -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)
|
|
|
}
|
|
|
},
|
|
@@ -160,7 +163,7 @@ export default {
|
|
|
hideAdd
|
|
|
type={'editable-card'}
|
|
|
v-model={this.activeKey}
|
|
|
- tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '10px', paddingTop: '1px' }}
|
|
|
+ tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '16px', paddingTop: '1px' }}
|
|
|
{...{ on: { edit: onEdit } }}>
|
|
|
{panes}
|
|
|
</a-tabs>
|