Answer the question
In order to leave comments, you need to log in
Why does offsetTop always have the same value?
I am using tab method like here https://vuejs.org/v2/guide/components-dynamic-asyn...
<keep-alive>
<component v-bind:is="currentTabComponent"></component>
</keep-alive>
watch: {
scroll(value) {
if (value) {//Если значение true то нужно сделать автоскролл
this.$nextTick(() => {
let el = document.getElementsByClassName("tab-body scrolling")[0];
el.scrollTop = this.$refs[this.itemName].offsetTop - this.$refs[this.itemName].scrollHeight;
//В итоге выходит в той вкладке которая проблемная, el.scrollTop = 0;
// this.$refs[this.itemName].offsetTop = 729
//this.$refs[this.itemName].scrollHeight = 205
});
}
},
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question