add
This commit is contained in:
parent
4f6b766830
commit
af3e7d0258
|
|
@ -103,6 +103,18 @@ export default {
|
|||
},
|
||||
showTitleInside (item) {
|
||||
return showTitle(item, this)
|
||||
},
|
||||
moveToView (tag) {
|
||||
if (tag.offsetLeft < -this.tagBodyLeft) {
|
||||
// 标签在可视区域左侧
|
||||
this.tagBodyLeft = -tag.offsetLeft + 10
|
||||
} else if (tag.offsetLeft + 10 > -this.tagBodyLeft && tag.offsetLeft + tag.offsetWidth < -this.tagBodyLeft + this.$refs.scrollCon.offsetWidth - 100) {
|
||||
// 标签在可视区域
|
||||
this.tagBodyLeft = Math.min(0, this.$refs.scrollCon.offsetWidth - 100 - tag.offsetWidth - tag.offsetLeft - 20)
|
||||
} else {
|
||||
// 标签在可视区域右侧
|
||||
this.tagBodyLeft = -(tag.offsetLeft - (this.$refs.scrollCon.offsetWidth - 100 - tag.offsetWidth) + 20)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
|
@ -112,6 +124,7 @@ export default {
|
|||
console.log(this.$route.name, item.name)
|
||||
if (this.$route.name === item.name) {
|
||||
let tag = this.refsTag[index].$el
|
||||
console.log(tag)
|
||||
this.moveToView(tag)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue