Skip to content

Commit

Permalink
Add name, fix computed components
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Richter committed Apr 11, 2018
1 parent c1c50dc commit ee04f88
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/components/ListView/_ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<div class="four column centered row">
<p class="column tasks">
Completed Tasks:
<b>{{todos.filter(todo => todo.done).length}}</b>
<b>{{ counterDone }}</b>
</p>
<p class="column tasks">
Pending Tasks:
<b>{{todos.filter(todo => !todo.done).length}}</b>
<b>{{ counterTodo }}</b>
</p>
</div>

Expand All @@ -31,9 +31,12 @@
import sweetalert from 'sweetalert'
import Todo from './Todo.vue'
import CreateTodo from './TodoCreate.vue'
import { TheHeader } from 'src/components'
// Todo: use absolute path src/ as root https://github.com/parcel-bundler/parcel/pull/850
import { TheHeader } from '../index.js'
export default {
name: 'ListView',
components: {
Todo,
CreateTodo,
Expand Down Expand Up @@ -62,6 +65,16 @@
}
},
// Like methods, but are cached until dependency changes
computed: {
counterDone () {
return this.todos.filter(todo => todo.done).length
},
counterTodo() {
return this.todos.filter(todo => !todo.done).length
},
},
methods: {
deleteTodo(todo) {
sweetalert(
Expand Down

0 comments on commit ee04f88

Please sign in to comment.