Home >Web Front-end >JS Tutorial >After Vue renders the page, the div scroll bar is positioned at the bottom (code attached)
This time I will bring you the div scroll bar positioned at the bottom after vue renders the page (with code). After vue renders the page, the div scroll bar is positioned at the bottom. What are the precautions? What are the following? Let’s take a look at practical cases.
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; }) }
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website !
Recommended reading:
aggregate cascade query implementation steps
JS analysis of the method of generating a QR code image from a link
vue2.0 dynamic component and render usage instructions
The above is the detailed content of After Vue renders the page, the div scroll bar is positioned at the bottom (code attached). For more information, please follow other related articles on the PHP Chinese website!