Try using the index from the loop
v-for="(cripto, index) in criptos">
{{ this.id_item_pagination + index }}
In saying that, shouldn't that info already be available to you in the pagination object? Look for 'from' and 'to'.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In short, I want to display an ID that goes from 1 to the last element of the pagination. So that page one has ID from 1 to 20, page two from 21 to 30 and so on.
It seems simple, but I've tried everything and it doesn't work.
My loop:
<tr class="odd:bg-fundo" v-for="cripto in criptos">
<td class="border-l border-borda p-4 text-center">{{ this.id_item_pagination + 1 }}</td>
<td class="border-l border-borda p-4 text-center">{{cripto.nome}} </td>
</td>
<script>
export default {
props: ['criptos','pagination'],
data () {
return {
id_item_pagination: this.pagination.from,
}
},
I simply store the "From" information of the data object as it tells me where to start the loop. But inside v-for I try to increment + 1, and it returns the same number in all. If it starts at 1, all lines come with the number 2.
Why is this happening if I am incrementing 1 with each loop iteration?
It seems simple, but I've been doing this for hours and I can't get anywhere.
Try using the index from the loop
v-for="(cripto, index) in criptos">
{{ this.id_item_pagination + index }}
In saying that, shouldn't that info already be available to you in the pagination object? Look for 'from' and 'to'.
Please or to participate in this conversation.