Home > Web Front-end > JS Tutorial > After Vue renders the page, the div scroll bar is positioned at the bottom (code attached)

After Vue renders the page, the div scroll bar is positioned at the bottom (code attached)

php中世界最好的语言
Release: 2018-05-10 14:23:50
Original
3383 people have browsed it

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;
  })
 }
Copy after login
//第一次页面渲染完之后滚动条在最底部
methods:function(){
  this.$nextTick(function(){
  var p = document.getElementById('dialogue_box');
  p.scrollTop = p.scrollHeight;
  })
 }
Copy after login

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!

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