client: add task component

This commit is contained in:
Matteo Pagliazzi
2017-01-17 18:07:02 +01:00
parent e7de8b8e2f
commit e2b06161e1
2 changed files with 41 additions and 8 deletions

View File

@@ -1,18 +1,19 @@
<template lang="pug">
.row
.sixteen.wide.column
p You have {{tasksCount}} tasks!
.four.wide.column(v-for="taskType in tasksTypes")
h3 {{taskType}}s ()
h3 {{taskType}}s
ul
li(v-for="task in tasks", v-if="task.type === taskType", :key="task.id")
span {{task.text}}
task(v-for="task in tasks", v-if="task.type === taskType", :key="task.id", :task="task")
</template>
<script>
import Task from './task';
import { mapState } from '../store';
export default {
components: {
Task,
},
data () {
return {
tasksTypes: ['habit', 'daily', 'todo', 'reward'],
@@ -20,9 +21,6 @@ export default {
},
computed: {
...mapState(['tasks']),
...mapState({
tasksCount: (state) => state.tasks.length,
}),
},
};
</script>