提交 510a986e 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

修复了tab右键相关操作的bug

上级 fe326bd9
...@@ -100,36 +100,55 @@ export default { ...@@ -100,36 +100,55 @@ export default {
sessionStorage.setItem('historys', JSON.stringify(this.historys)) sessionStorage.setItem('historys', JSON.stringify(this.historys))
}, },
closeLeft() { closeLeft() {
let right
const rightIndex = this.historys.findIndex( const rightIndex = this.historys.findIndex(
item => item.name == this.rightActive item => {
if(item.name == this.rightActive){
right = item
}
return item.name == this.rightActive
}
) )
const activeIndex = this.historys.findIndex( const activeIndex = this.historys.findIndex(
item => item.name == this.activeValue item => item.name == this.activeValue
) )
this.historys.splice(0, rightIndex) this.historys.splice(0, rightIndex)
if (rightIndex > activeIndex) { if (rightIndex > activeIndex) {
this.$router.push({ name: this.rightActive }) this.$router.push(right)
} }
sessionStorage.setItem('historys', JSON.stringify(this.historys)) sessionStorage.setItem('historys', JSON.stringify(this.historys))
}, },
closeRight() { closeRight() {
let right
const leftIndex = this.historys.findIndex( const leftIndex = this.historys.findIndex(
item => item.name == this.rightActive item => {
if(item.name == this.rightActive){
right = item
}
return item.name == this.rightActive
}
) )
const activeIndex = this.historys.findIndex( const activeIndex = this.historys.findIndex(
item => item.name == this.activeValue item => item.name == this.activeValue
) )
this.historys.splice(leftIndex + 1, this.historys.length) this.historys.splice(leftIndex + 1, this.historys.length)
if (leftIndex < activeIndex) { if (leftIndex < activeIndex) {
this.$router.push({ name: this.rightActive }) this.$router.push(right)
} }
sessionStorage.setItem('historys', JSON.stringify(this.historys)) sessionStorage.setItem('historys', JSON.stringify(this.historys))
}, },
closeOther() { closeOther() {
let right
this.historys = this.historys.filter( this.historys = this.historys.filter(
item => item.name == this.rightActive item => {
if(item.name == this.rightActive){
right = item
}
return item.name == this.rightActive
}
) )
this.$router.push({ name: this.rightActive }) console.log(right)
this.$router.push(right)
sessionStorage.setItem('historys', JSON.stringify(this.historys)) sessionStorage.setItem('historys', JSON.stringify(this.historys))
}, },
setTab(route) { setTab(route) {
...@@ -154,9 +173,9 @@ export default { ...@@ -154,9 +173,9 @@ export default {
this.$router.push({ name: 'dashboard' }) this.$router.push({ name: 'dashboard' })
} else { } else {
if (index < this.historys.length - 1) { if (index < this.historys.length - 1) {
this.$router.push({ name: this.historys[index + 1].name }) this.$router.push({ name: this.historys[index + 1].name,query:this.historys[index + 1].query,params:this.historys[index + 1].params })
} else { } else {
this.$router.push({ name: this.historys[index - 1].name }) this.$router.push({ name: this.historys[index - 1].name,query:this.historys[index - 1].query,params:this.historys[index - 1].params })
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册