File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 30
30
class =" card mt-2"
31
31
>
32
32
<div class =" card-body p-2" >
33
- {{ todo.subject }}
33
+ <div class =" form-check" >
34
+ <input
35
+ class =" form-check-input"
36
+ type =" checkbox"
37
+ v-model =" todo.completed"
38
+ >
39
+ <label class =" form-check-label" >
40
+ {{ todo.subject }}
41
+ </label >
42
+ </div >
43
+
34
44
</div >
35
45
</div >
36
46
</div >
@@ -42,10 +52,7 @@ import { ref } from 'vue';
42
52
export default {
43
53
setup () {
44
54
const todo = ref (' ' );
45
- const todos = ref ([
46
- {id: 1 , subject: ' 휴대폰 사기' },
47
- {id: 2 , subject: ' 장보기' },
48
- ]);
55
+ const todos = ref ([]);
49
56
const hasError = ref (false );
50
57
51
58
const onSubmit = () => {
@@ -54,9 +61,11 @@ export default {
54
61
} else {
55
62
todos .value .push ({
56
63
id: Date .now (),
57
- subject: todo .value
64
+ subject: todo .value ,
65
+ completed: true ,
58
66
});
59
67
hasError .value = false ;
68
+ todo .value = ' ' ;
60
69
}
61
70
};
62
71
You can’t perform that action at this time.
0 commit comments