diff --git a/src/components/ListView/_ListView.vue b/src/components/ListView/_ListView.vue
index 431442e..26b2574 100644
--- a/src/components/ListView/_ListView.vue
+++ b/src/components/ListView/_ListView.vue
@@ -8,11 +8,11 @@
Completed Tasks:
- {{todos.filter(todo => todo.done).length}}
+ {{ counterDone }}
Pending Tasks:
- {{todos.filter(todo => !todo.done).length}}
+ {{ counterTodo }}
@@ -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,
@@ -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(