-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (25 loc) · 707 Bytes
/
index.js
File metadata and controls
27 lines (25 loc) · 707 Bytes
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
const date = new Date();
const app=Vue.createApp(
{
data(){
return{
today:date.getDate()+"."+(date.getMonth()+1)+"."+date.getFullYear(),
tasks:[]
}
},
created(){
this.tasks= JSON.parse(localStorage.getItem("tasks"))??[];
},
methods: {
addTask(name){
this.tasks.push(name);
localStorage.setItem("tasks",JSON.stringify(this.tasks));
},
clear(){
this.tasks=[];
localStorage.setItem("tasks",JSON.stringify([]));
}
}
}
);
app.mount('#app');