Skip to content

Commit 967ff32

Browse files
committed
11
1 parent b0392df commit 967ff32

File tree

1 file changed

+23
-37
lines changed

1 file changed

+23
-37
lines changed

index.html

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,39 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta http-equiv="X-UA-Compatible" content="ie=edge">
77
<title>뷰 기초 익히기</title>
8-
<style>
9-
.red {
10-
color: red;
11-
}
12-
13-
.font-bold {
14-
font-weight: bold;
15-
}
16-
</style>
178
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
189
</head>
1910
<body>
2011
<div id="app">
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>
12+
{{ name }}<br>
13+
<button @click="changeText">Click</button>
14+
</div>
15+
<div id="app-1">
16+
{{ name }}<br>
17+
<button @click="changeText">Click</button>
3918
</div>
4019
<script>
41-
new Vue({
20+
const app = new Vue({
4221
el: '#app',
4322
data: {
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-
]
23+
name: 'kossie'
24+
},
25+
methods: {
26+
changeText() {
27+
app1.name = 'kossie updated';
28+
}
29+
},
30+
})
31+
32+
const app1 = new Vue({
33+
el: '#app-1',
34+
data: {
35+
name: 'kossie1'
5236
},
5337
methods: {
54-
38+
changeText() {
39+
app.name = 'kossie1 updated';
40+
}
5541
},
5642
})
5743
</script>

0 commit comments

Comments
 (0)