I have a chat feature in my vue
app.The message are loaded in a list as the following.
<div class="chat">
<ul v-chat-scroll>
<li
v-for="message in messages"
:key="message.id"
:class="message.from == 'a' ? 'message-card-left' : 'message-card-right'"
>
<Card class="message-card">
<template slot="content">
{{message.message}}
</template>
<template class="message-time" slot="footer">
{{message.time}}
</template>
</Card>
</li>
</ul>
</div>
The messages variable looks like:
messages: [
{
id: 1,
from: 'a',
to: 'b',
message:'time',
time: '1:00'
},
{
id: 2,
from: 'b',
to: 'a',
message:'time',
time: '1:00'
},
]
I removed the other objects for readability. I want v-chat-scroll
to scroll the chat window to the last message. I am using primeVue
in this code too. Any help would be appreciated. Thanks.