TahaSh / vue-paginate

A simple vue.js plugin to paginate data
MIT License
594 stars 103 forks source link

How do I enumerate the List? #88

Closed lucassimines closed 6 years ago

lucassimines commented 6 years ago

If I use a key to display the list number and go to page 2, it resets and go back to 1, for sure. But, there is any option to continue counting on every page?

I would like to keep couting the row number when I change the page.

Page 1:

1. item 1
2. item 2
3. item 3

Page 2:

4. item 4
5.item 5

...

TahaSh commented 6 years ago

@fmcdigital You can use the current page value and the number of items per page to calculate the item's order across all pages:

<li v-for="(item, index) in paginated('items')">
  {{ paginate.items.page * 3 + index + 1 }}. {{ item }}
</li>

In this example, I'm assuming that your paginated list is named items and the number of items per page is 3.

lucassimines commented 6 years ago

Yes, I already solved it, thanks for help :)