April 2017
Intermediate to advanced
454 pages
12h 51m
English
When enumerating an array, we also have access to the index, represented by the variable i in the following code:
<div id="app"> <ul> <li v-for="(animal, i) in animals"> The {{animal}} goes {{sounds[i]}} </li> </ul> </div>
new Vue({ el: '#app', data: { animals: ['dog', 'cat', 'bird'], sounds: ['woof', 'meow', 'tweet'] } })

Read now
Unlock full access