-
Notifications
You must be signed in to change notification settings - Fork 0
/
lista.html
36 lines (32 loc) · 827 Bytes
/
lista.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>VUE js V2 Listas | Device 4 Code</title>
</head>
<body>
<div id="main">
<ul>
<li v-for="item in people" v-text="item"></li>
</ul>
<input type="text" v-model="name" v-on:keyup.enter="addName">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.2/vue.js"></script>
<script type="text/javascript">
new Vue({
el: '#main',
data: {
people: ['Roger', 'André', 'Eduardo', 'Ricardo']
},
methods: {
addName: function() {
this.people.push(this.name);
this.name = '';
}
}
});
</script>
</body>
</html>