S
S
Sector5672020-07-04 09:44:21
JavaScript
Sector567, 2020-07-04 09:44:21

How to get part of the content on request, and load the rest as needed in vue.js?

That is, to implement the so-called lazy loading.
EXAMPLE:
Here, using axios, I send a request, I receive a response with an array with 100 url addresses for pictures.

If I just go through this array through a loop and write all the paths to the src of the img tag, then accordingly I will have
100 pictures at once.

But I need, for example, only 10 pictures to appear, and with the help of pagination, when I switch the next page, another 10 are loaded, when I switch to the third page, another 10, etc.

So, how can this be implemented correctly in vue.js?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-07-04
@Sector567

Split the array into chunks and give the desired chunk on the desired page. Your K.O.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question