Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloydjatkinson/9a2e01a9e82e0edfcf4815662995f4d8 to your computer and use it in GitHub Desktop.
Save lloydjatkinson/9a2e01a9e82e0edfcf4815662995f4d8 to your computer and use it in GitHub Desktop.
<script lang="ts">
import { defineComponent } from 'vue';
import { mapActions, mapStores } from 'pinia';
import { useTodoStore } from '../store';
export default defineComponent({
name: 'TodoList',
computed: {
...mapStores(useTodoStore),
notStarted (): readonly Todo[] {
return this.todoStore.notStarted;
},
finished (): readonly Todo[] {
return this.todoStore.done;
},
},
methods: {
...mapActions(useTodoStore, [
'addNew',
'remove',
'updateDescription',
'updateTitle',
'updateProgress',
'updateAllProgress',
]),
addTestTodo () {
this.addNew({ title: 'test todo', description: '', progress: Progress.NotStarted });
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment