-1

i'm rendering list of +1000 users, is there a way for example to show the first 20 users then the second 20 until the end? because it takes some time to render all the users at one time

or render the first 20 users then show the rest i can for example v-for users.splice(0,20), then v-for the rest users.splice(21) is there any simple way to do things

shilovk
  • 11,718
  • 17
  • 75
  • 74

1 Answers1

0

What you are attempting to do is possible by adding a page variable, that contains information which page the user is currently on and adding a computed property to return the users.

computed: {
   filteredUsers() {
      return this.users.slice(20 * this.page, 20 * (this.page + 1));
   }
}

Then if you use v-for over this array you get the desired functionality. To get the following 20 users you will just need to increment page by one.

Lassi Uosukainen
  • 1,598
  • 13
  • 22