-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (41 loc) · 1.03 KB
/
index.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
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TodoList</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id = "app">
<input v-model = "newTodo"type="text">
<button v-on:click="addTodo">Add</button>
<button v-on:click="reverseTodos">Flip List</button>
<ul id = "todo-list">
<li v-for="todo in todos">
<input type="checkbox" v-bind:checked="todo.done">
<span>{{todo.task}}</span>
</li>
</ul>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
newTodo: '',
todos: [
{task: 'First Task', done: false},
{task: 'Second Task', done: true}
]
},
methods: {
addTodo: function () {
this.todos.push({task: this.newTodo})
},
reverseTodos: function () {
this.todos.reverse();
}
}
})
</script>
</body>
</html>