Skip to content

Commit b0392df

Browse files
committed
10
1 parent 9b86b49 commit b0392df

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

index.html

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,40 @@
1818
</head>
1919
<body>
2020
<div id="app">
21-
<!-- <template v-if="number === 1">
22-
<div>1</div>
23-
<div>2</div>
24-
<div>3</div>
25-
</template>
26-
<div v-else-if="number === 2">Hi</div>
27-
<div v-else>No</div> -->
28-
<div v-show="show">Yes</div>
29-
<br>
30-
<button @click="toggle">Toggle</button>
21+
<div>
22+
{{ people[0].name }} {{ people[0].age }}
23+
</div>
24+
<div>
25+
{{ people[1].name }} {{ people[1].age }}
26+
</div>
27+
<div>
28+
{{ people[2].name }} {{ people[2].age }}
29+
</div>
30+
<div>
31+
{{ people[3].name }} {{ people[3].age }}
32+
</div>
33+
34+
<hr>
35+
36+
<div v-for="(person, index) in people" :key="person.id">
37+
{{ person.name }} {{ person.age }} {{ index }}
38+
</div>
3139
</div>
3240
<script>
3341
new Vue({
3442
el: '#app',
3543
data: {
36-
number: 1,
37-
show: false
44+
people: [
45+
{ id: 1, name: 'a', age: 20 },
46+
{ id: 2, name: 'b', age: 21 },
47+
{ id: 3, name: 'c', age: 22 },
48+
{ id: 4, name: 'd', age: 23 },
49+
{ id: 5, name: 'e', age: 24 },
50+
{ id: 6, name: 'e', age: 25 },
51+
]
3852
},
3953
methods: {
40-
increaseNumber() {
41-
this.number++;
42-
},
43-
toggle() {
44-
this.show = !this.show;
45-
}
54+
4655
},
4756
})
4857
</script>

0 commit comments

Comments
 (0)