Vue allows you to get both the item and the index in a v-for loop:

Basic Syntax:

index-v

Example

Template:

template

Note on:key

While you can use the index as the key:
:key=”index”

It’s better to use a unique identifier if possible, like an id, to avoid rendering issues:
:key=”item.id”

Need Help With Vue Development?

Work with our skilled Vue developers to accelerate your project and boost its performance.

Hire Vuejs Developers

Support On Demand!

Related Q&A