Home > Article > Web Front-end > How to keep the scroll bar of a div at the bottom after each page rendering in vue
Below I will share with you an article on how to keep the scroll bar of p at the bottom after each rendering of the page in vue. It has a good reference value and I hope it will be helpful to everyone.
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; }) }
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Detailed explanation of dynamic components and render based on vue2.0
Introduction to the calling sequence of functions in vue
JS implementation example of adding event operations to dynamically created elements
##
The above is the detailed content of How to keep the scroll bar of a div at the bottom after each page rendering in vue. For more information, please follow other related articles on the PHP Chinese website!