-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (31 loc) · 916 Bytes
/
app.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
let id = 0;
const app = Vue.createApp({
data() {
return {
hideCompleted: false,
newTodo: '',
todos :[
{id: ++id, text: 'Try new app in Vue',done:true},
{id: ++id, text: 'Learn Actix Web',done:true},
{id: ++id, text: 'Learn Rust Programming',done:false},
{id: ++id, text: 'Learn Sanskrit',done:false},
{id: ++id, text: 'Learn Vedas',done:false},
]
}
},
computed: {
filteredList() {
return this.hideCompleted ? this.todos.filter((t)=> !t.done) : this.todos
}
},
methods: {
addTodo() {
this.todos.push({id: ++id, text: this.newTodo,done:false})
this.newTodo='';
},
removeTodo(todo) {
this.todos = this.todos.filter((t)=> t!=todo)
}
}
})
app.mount('#app')