D
D
danyadev2018-12-05 20:53:25
JavaScript
danyadev, 2018-12-05 20:53:25

How to save the scroll position when switching between conversations?

I have a wrap with messages and the messages themselves

<div class="messages_list" v-for="message of messages">
<message :msg="message"></message>
</div>

messages is a computed property that changes after the id of the active dialog changes.
I can save the scroll position before changing the dialog id and update this position when new messages from this dialog are already loaded.
But how to get and update this position? (you can add this position to the conversation data in Vuex)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-12-05
@danyadev

Put a ref on the scrollable element, and read/assign it to scrollTop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question