1<div v-for="item in itens" :key="item.id">
2 {{ item.text }}
3</div>
4
5// if you need the index
6
7<div v-for="(item, index) in items">
8 {{ index }} - {{ item.message }}
9</div>
10
1<ul id="example-1">
2 <li v-for="item in items" :key="item.message">
3 {{ item.message }}
4 </li>
5</ul>
1<ul id="example-1">
2 <li v-for="item in items" :key="item.message">
3 {{ item.message }}
4 </li>
5</ul>
6
7
8const example1 = new Vue({
9 el: '#example-1',
10 data: {
11 items: [
12 { message: 'Foo' },
13 { message: 'Bar' }
14 ]
15 }
16})
1<ul>
2 <li v-for="(item, index) in items">
3 {{ index }} - {{ item }}
4 </li>
5</ul>
1<option v-for="(location, index) in locations" v-bind:value="location.id" v-bind:selected="index === 0">
2 {{ location.from }} - {{ location.to }}
3</option>