This article mainly shares with you a method of keeping the scroll bar of p at the bottom after each vue renders the page. It has a good reference value and I hope it can help everyone.
The examples are as follows:
//每次页面渲染完之后滚动条在最底部 updated:function(){ this.$nextTick(function(){ var p = document.getElementById('dialogue_box'); p.scrollTop = p.scrollHeight; }) }
//第一次页面渲染完之后滚动条在最底部 methods:function(){ this.$nextTick(function(){ var p = document.getElementById('dialogue_box'); p.scrollTop = p.scrollHeight; }) }
Related recommendations:
Use js or jq Sharing the implementation method of setting the scroll bar
How to configure the scroll bar style of H5
How to modify the scroll bar style
The above is the detailed content of How to keep the scroll bar of a div at the bottom after Vue renders the page. For more information, please follow other related articles on the PHP Chinese website!