+7
-2
lines changedFilter options
+7
-2
lines changed Original file line number Diff line number Diff line change
@@ -31,10 +31,16 @@ const todoApp = new Vue({
31
31
const index = this.todos.indexOf(todo);
32
32
this.todos.splice(index, 1);
33
33
},
34
+
clearCompleted() {
35
+
this.todos = this.activeTodos;
36
+
}
34
37
},
35
38
computed: {
36
39
activeTodos() {
37
40
return this.todos.filter(t => !t.isDone);
41
+
},
42
+
completedTodos() {
43
+
return this.todos.filter(t => t.isDone);
38
44
}
39
45
}
40
46
});
Original file line number Diff line number Diff line change
@@ -58,8 +58,7 @@ <h1 v-text="title"></h1>
58
58
</li>
59
59
</ul>
60
60
61
-
<!-- Hidden if no completed items are left ↓ -->
62
-
<button class="clear-completed">Clear completed</button>
61
+
<button class="clear-completed" @click="clearCompleted" v-show="completedTodos.length">Clear completed</button>
63
62
</footer>
64
63
</section>
65
64
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4