File tree 3 files changed +19
-4
lines changed
3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,18 @@ const app = Vue.createApp({
5
5
return {
6
6
newTodo : '' ,
7
7
todos :[
8
- { id : ++ id , text : 'Try new app in Vue' } ,
9
- { id : ++ id , text : 'Learn Actix Web' }
8
+ { id : ++ id , text : 'Try new app in Vue' , done :true } ,
9
+ { id : ++ id , text : 'Learn Actix Web' , done :true } ,
10
+ { id : ++ id , text : 'Learn Rust Programming' , done :false } ,
11
+ { id : ++ id , text : 'Learn Sanskrit' , done :false } ,
12
+ { id : ++ id , text : 'Learn Vedas' , done :false } ,
10
13
]
11
14
12
15
}
13
16
} ,
14
17
methods : {
15
18
addTodo ( ) {
16
- this . todos . push ( { id : ++ id , text : this . newTodo } )
19
+ this . todos . push ( { id : ++ id , text : this . newTodo , done : false } )
17
20
this . newTodo = '' ;
18
21
} ,
19
22
Original file line number Diff line number Diff line change 4
4
< meta charset ="UTF-8 ">
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
6
< title > Simple Vue Js ToDo UI</ title >
7
+ < link rel ="stylesheet " href ="style.css ">
7
8
< script src ="https://unpkg.com/vue@3 "> </ script >
8
9
</ head >
9
10
< body >
11
+ < h1 > Simple To Do List in Vue-JS 3</ h1 >
10
12
< div id ="app ">
11
13
12
14
< input v-model ="newTodo "> </ input >
13
15
< button @click ="addTodo() "> Add Task</ button >
14
16
< ul >
15
17
< li v-for ="todo in todos " :key ="todo.id ">
16
- {{ todo.text }}
18
+ < input type ="checkbox " v-model ="todo.done ">
19
+ < span :class ="{ completed: todo.done } "> {{ todo.text }}</ span >
17
20
< button @click ="removeTodo(todo) "> Remove</ button >
18
21
</ li >
19
22
</ ul >
Original file line number Diff line number Diff line change
1
+ body {
2
+ margin : 0 auto;
3
+ background-color : beige;
4
+ color : black;
5
+ padding : 20px ;
6
+ }
7
+ .completed {
8
+ text-decoration : line-through;
9
+ }
You can’t perform that action at this time.
0 commit comments