Skip to content

Commit 026c1b4

Browse files
committed
15
1 parent 4aea66f commit 026c1b4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/App.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
type="checkbox"
3737
v-model="todo.completed"
3838
>
39-
<label class="form-check-label">
39+
<label
40+
class="form-check-label"
41+
:class="{ todo: todo.completed }"
42+
>
4043
{{ todo.subject }}
4144
</label>
4245
</div>
@@ -54,6 +57,10 @@ export default {
5457
const todo = ref('');
5558
const todos = ref([]);
5659
const hasError = ref(false);
60+
const todoStyle = {
61+
textDecoration: 'line-through',
62+
color: 'gray'
63+
};
5764
5865
const onSubmit = () => {
5966
if (todo.value === '') {
@@ -62,7 +69,7 @@ export default {
6269
todos.value.push({
6370
id: Date.now(),
6471
subject: todo.value,
65-
completed: true,
72+
completed: false,
6673
});
6774
hasError.value = false;
6875
todo.value = '';
@@ -74,13 +81,15 @@ export default {
7481
todos,
7582
onSubmit,
7683
hasError,
84+
todoStyle,
7785
};
7886
}
7987
}
8088
</script>
8189

8290
<style>
83-
.name {
84-
color: red;
91+
.todo {
92+
color: gray;
93+
text-decoration: line-through;
8594
}
8695
</style>

0 commit comments

Comments
 (0)