-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
57 lines (57 loc) · 1.17 KB
/
main.js
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
const options = {
data() {
return {
title: "Mis actividades",
subtitle: "Tengo 5 actividades",
tasks: [
{
id: 1,
title: "Comprar el libros el fin de semana",
done: false,
dueDate: "2021-10-27",
},
{
id: 2,
title: "Limpiar mi cuarto",
done: true,
dueDate: "2021-11-27",
},
],
defaultTask: {
title: "",
done: false,
dueDate: "",
},
currentTask: {
title: "",
done: false,
dueDate: "",
},
currentDate: "2021-10-03",
};
},
computed:{
doneActivities(){
return this.tasks.filter(t=>t.done)
},
totalDoneActitivities(){
return this.doneActivities.length
}
},
watch:{
"currentTask.title"(newValue, oldValue){
console.log(newValue, oldValue)
}
},
methods: {
deleteTaskByIndex(index){
this.tasks.splice(index, 1)
},
addTask(task) {
console.log(task )
this.tasks.push(Object.assign({}, task));
this.currentTask = Object.assign({}, this.defaultTask);
},
},
};
const app = Vue.createApp(options);