Skip to content

Commit 4aea66f

Browse files
committed
14
1 parent af1074a commit 4aea66f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/App.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@
3030
class="card mt-2"
3131
>
3232
<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+
3444
</div>
3545
</div>
3646
</div>
@@ -42,10 +52,7 @@ import { ref } from 'vue';
4252
export default {
4353
setup() {
4454
const todo = ref('');
45-
const todos = ref([
46-
{id: 1, subject: '휴대폰 사기'},
47-
{id: 2, subject: '장보기'},
48-
]);
55+
const todos = ref([]);
4956
const hasError = ref(false);
5057
5158
const onSubmit = () => {
@@ -54,9 +61,11 @@ export default {
5461
} else {
5562
todos.value.push({
5663
id: Date.now(),
57-
subject: todo.value
64+
subject: todo.value,
65+
completed: true,
5866
});
5967
hasError.value = false;
68+
todo.value = '';
6069
}
6170
};
6271

0 commit comments

Comments
 (0)