-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-events.html
95 lines (84 loc) · 2.45 KB
/
4-events.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Curso Profesional Vue.js</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
.b-task {
cursor: pointer;
}
.b-task.is-completed {
color: gray;
}
.is-completed .glyphicon {
color: green;
}
.is-uncompleted .glyphicon {
color: orange;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1>Manejo de Eventos</h1>
<div class="b-tasks-container">
<h2>Mis tareas</h2>
<ul class="b-tasks">
<li class="b-task" v-for="task in tasks" @click="completeTask(task)"
:class="{'is-completed' : task.completed, 'is-uncompleted': ! task.completed}">
<span>{{ task.title }}</span>
<span class="glyphicon glyphicon-ok"></span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script src="../js/vue.js"></script>
<script>
(function() {
new Vue({
el: '#app',
data: {
newTask: '',
tasks: [
{
title: 'Enviar email a proveedores',
completed: false
},
{
title: 'Hablar por teléfono con mamá',
completed: true
},
{
title: 'Reservar restaurante para la cena',
completed: false
},
{
title: 'Buscar libro sobre IA',
completed: false
}
]
},
methods: {
completeTask: function(task) {
task.completed = true;
}
},
computed: {
sortedTasks: function() {
return this.tasks.sort();
}
}
});
})();
</script>
</body>
</html>