0

I'm trying pagination in vuejs & My code in fiddle

v-for="(number, item) in items | filterBy name in 'name' | limitBy count offset"

my quetion is how can get index in pagination?

for example : I have data in paging or page one :

index :"1" - Kathy Sparks

index :"2" - Gladys Tate

and then if I'm click paging two, I want to index continue

index : 3 - Shannon

index : 4 - Rosetta Scott

2 Answers 2

0

I would suggest putting the output of each item into a child component and passing the index of that item in the array as a param. There are other ways to do it, such as passing the item from your vue template into a method and looking up the index of the field, eg:

// vue template
{{ whatIndex(item) }}

// vue js
vue.methods.whatIndex = function (item) { 
  // some logic to lookup the name from this.items
  return i
}
Sign up to request clarification or add additional context in comments.

Comments

0

Fastest way:

{{number + offset + 1}} - {{item.name}}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.