A
A
Analka2020-02-06 01:33:02
Vue.js
Analka, 2020-02-06 01:33:02

Vue js infinite loading of data when scrolling up?

How to call the getMessages method when scrolling up a block

<ul class="chat--messages__wrapper" v-if="messages.length > 0" ref="msg_wrapper">
        <li class="chat--messages__item" v-bind:class="{ user: message.user_id === userAuth.id }" v-for="(message,index) in messages">
            <div class="chat--user__image" v-bind:style='{ backgroundImage: `url("/storage/${message.avatar}")` }'></div>
            <div class="chat--user__data">
                <p class="last--massage" v-html="message.replay"></p>
            </div>
        </li>
    </ul>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-02-06
@Analka

Just like in regular JS: https://learn.javascript.ru/onscroll
Attach an event handler in the mounted hook

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question