I am learning vue
. I have the following method where I add a chat message to a div with id=\"toolbar-chat\"
. This div allows scrolling on y axis an
This is old, but for someone who want to find solution like me:
addMessage(message) {
this.messages.unshift(message);
this.$nextTick(() => {
// block: 'end' will scroll to top of element instead of bottom
this.$refs.toolbarChat.$el.scrollIntoView({ block: 'end', scrollBehavior: 'smooth' });
});
axios.post(chat_send_route, message)
.then(response => {
console.log(response.data);
});
}