I had a similar issue but I took a different approach using the vue.nextTick()
. I needed to be sure the v-for
had finished rendering as the component will not re-render immediately, It will update on the next “tick” when the queue is empty.
Vue.component('message', {
data() {
return {
message: []
}
},
methods: {
updateMessageArray(newMessage) {
this.message.push(newMessage);
this.$nextTick(() => {
// Scroll Down
})
}
}
})
https://v2.vuejs.org/v2/api/#Vue-nextTick
https://v2.vuejs.org/v2/guide/reactivity.html#Async-Update-Queue