H5 page cannot get scroll bar height

when the vue page jumps to the page, the scroll bar is always in the middle (only ios will be in the middle),

clipboard.png

0

clipboard.png,

there are great gods who encounter the same problems, please show us the way

Mar.20,2021

because the for loop first gets the height of the scroll bar and then loads the data, the scroll bar defaults to the bottom.
watch: {
chatlog () {

 console.log("chatlog change");
 this.$nextTick(() => {
   var container = this.$el.querySelector("-sharpchatContainer");
   console.log(container);
   container.scrollTop = container.scrollHeight;
 })
 //  document.getElementById('chatContainer').scrollTop = document.getElementById('chatContainer').scrollHeight+150;

}
}

Menu