Home > Web Front-end > JS Tutorial > body text

How to keep the scroll bar of a div at the bottom after each page rendering in vue

亚连
Release: 2018-05-29 17:00:38
Original
2498 people have browsed it

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;
  })
 }
Copy after login

//第一次页面渲染完之后滚动条在最底部
methods:function(){

  this.$nextTick(function(){
  var p = document.getElementById('dialogue_box');
  p.scrollTop = p.scrollHeight;
  })
 }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!