Answer the question
In order to leave comments, you need to log in
How to automatically scroll down a block?
There is a block
<div class="oldComments mb-3" ref="oldComments">
<ul class="commentList">
<li v-for="(comment,i) in history" :key="i" class="comment">
<span class="date">Сообщение от: {{comment.date}}</span><br>
<span class="name">{{comment.name}}: </span>
<span>{{comment.text}}</span>
<hr>
</li>
</ul>
</div>
axios
.get(url)
.then(function (response) {
if (response.data.status){
that.history = response.data.result
that.scrollToEnd()
}
})
.catch(function (error) {
console.log(error);
})
scrollToEnd: function() {
let messageDisplay = this.$refs.oldComments;
this.$refs.oldComments.scrollTop = messageDisplay.scrollHeight;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question