0๐
โ
I think you need to add the document.getElementById('chat').scrollTop=9999;
to a Vue.$nextTick
so that the information has time to appear and effect the element before the scroll effect is actuated.
You may also want to add a ref="chat"
to your chat element so you can reference scrollTop via the vue reference; it would look something like this
addMessage(message) {
axios.post('/chat/add', message).then(response => {
this.messages.push(response.data)
this.$nextTick(
() => {
this.$refs.chat.scrollTop=9999;
}
)
})
}
๐คJustin MacArthur
Source:stackexchange.com