Skip to content

Commit 2022a41

Browse files
author
QM303176530
committed
修复了tab右键相关操作的bug
1 parent 9804368 commit 2022a41

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

web/src/view/layout/aside/historyComponent/history.vue

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,55 @@ export default {
100100
sessionStorage.setItem('historys', JSON.stringify(this.historys))
101101
},
102102
closeLeft() {
103+
let right
103104
const rightIndex = this.historys.findIndex(
104-
item => item.name == this.rightActive
105+
item => {
106+
if(item.name == this.rightActive){
107+
right = item
108+
}
109+
return item.name == this.rightActive
110+
}
105111
)
106112
const activeIndex = this.historys.findIndex(
107113
item => item.name == this.activeValue
108114
)
109115
this.historys.splice(0, rightIndex)
110116
if (rightIndex > activeIndex) {
111-
this.$router.push({ name: this.rightActive })
117+
this.$router.push(right)
112118
}
113119
sessionStorage.setItem('historys', JSON.stringify(this.historys))
114120
},
115121
closeRight() {
122+
let right
116123
const leftIndex = this.historys.findIndex(
117-
item => item.name == this.rightActive
124+
item => {
125+
if(item.name == this.rightActive){
126+
right = item
127+
}
128+
return item.name == this.rightActive
129+
}
118130
)
119131
const activeIndex = this.historys.findIndex(
120132
item => item.name == this.activeValue
121133
)
122134
this.historys.splice(leftIndex + 1, this.historys.length)
123135
if (leftIndex < activeIndex) {
124-
this.$router.push({ name: this.rightActive })
136+
this.$router.push(right)
125137
}
126138
sessionStorage.setItem('historys', JSON.stringify(this.historys))
127139
},
128140
closeOther() {
141+
let right
129142
this.historys = this.historys.filter(
130-
item => item.name == this.rightActive
143+
item => {
144+
if(item.name == this.rightActive){
145+
right = item
146+
}
147+
return item.name == this.rightActive
148+
}
131149
)
132-
this.$router.push({ name: this.rightActive })
150+
console.log(right)
151+
this.$router.push(right)
133152
sessionStorage.setItem('historys', JSON.stringify(this.historys))
134153
},
135154
setTab(route) {
@@ -154,9 +173,9 @@ export default {
154173
this.$router.push({ name: 'dashboard' })
155174
} else {
156175
if (index < this.historys.length - 1) {
157-
this.$router.push({ name: this.historys[index + 1].name })
176+
this.$router.push({ name: this.historys[index + 1].name,query:this.historys[index + 1].query,params:this.historys[index + 1].params })
158177
} else {
159-
this.$router.push({ name: this.historys[index - 1].name })
178+
this.$router.push({ name: this.historys[index - 1].name,query:this.historys[index - 1].query,params:this.historys[index - 1].params })
160179
}
161180
}
162181
}

0 commit comments

Comments
 (0)