Question · Vue.js course · Module 2: Template Syntax
v-for with Index
How do you get the element index in v-for?
Answer options
- v-for="items as (item, index)"
- v-for="(item, index) in items"
- v-for="item in items" :index="i"
- v-for="item in items" v-index="i"
Show the answer
Correct answer:
- v-for="(item, index) in items"