Permalink
Browse files

Items left count with `computed` properties

  • Loading branch information...
amejiarosario committed Aug 13, 2018
1 parent 45b4eed commit 24ae5a0f74c226325d88a2aaecad9e40b35760fb
Showing with 7 additions and 2 deletions.
  1. +5 −0 app.js
  2. +2 −2 index.html
5 app.js
@@ -31,5 +31,10 @@ const todoApp = new Vue({
const index = this.todos.indexOf(todo);
this.todos.splice(index, 1);
},
},
computed: {
activeTodos() {
return this.todos.filter(t => !t.isDone);
}
}
});
@@ -41,9 +41,9 @@ <h1 v-text="title"></h1>
<!-- This footer should hidden by default and shown when there are todos -->
<footer class="footer">
<!-- This should be `0 items left` by default -->
<span class="todo-count">
<strong>0</strong> item left</span>
<strong>{{ activeTodos.length }}</strong> item(s) left</span>
<!-- Remove this if you don't implement routing -->
<ul class="filters">

0 comments on commit 24ae5a0

Please sign in to comment.