April 2017
Intermediate to advanced
454 pages
12h 51m
English
The preceding example can be refactored to match animal names and their sounds so that an accidental misalignment of the index will not affect our list.
<div id="app"> <ul> <li v-for="(sound, name) in animals"> The {{name}} goes {{sound}} </li> </ul> </div>
new Vue({ el: '#app', data: { animals: { dog: 'woof', cat: 'meow', bird: 'tweet' } } })