I am trying to scroll down on new appeared element in vue:
I have chat messages where I have two arrays:
data() {
return {
activeChats: [],
openedChats: [],
maxOpened: math.round(window.innerWidth / 300),
}
}
When I get new message and the conversation is not in active and opened arrays I add to both and it appears on screen because I used v-for on both arrays.
This everything works but I am not sure how to scroll down on div when new chat appears, I tried using refs but had no luck:
<div class="chat" v-for="chat in openedChats" ref="chat-{chat.id}"></div>
Or even just chat testing with one chat opened..
And inside axios then() after success I said:
this.$refs.chat['-'+response.data.id].scrollTo(9999999,99999999);
or
this.$refs.chat['-'+response.data.id].scrollTop = 99999999;
or
this.$refs.chat.scrollTo(9999999,99999999);
or
this.$refs.chat.scrollTop = 99999999;
And neither worked...
Any help ? :D
Can it be done without additional library, I need no animatios just to appear at the bottom of the element...
Thanks