Home  >  Article  >  Web Front-end  >  How to keep the scroll bar of a div at the bottom after vue renders the page

How to keep the scroll bar of a div at the bottom after vue renders the page

不言
不言Original
2018-06-29 13:58:571977browse

Let me 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 the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Introduction to the method of unifying vue coding style in vscode

Vue.js combined with Ueditor rich text How to use the editor

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!

Statement:
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