mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Usage of getters
This commit is contained in:
parent
32f1526c0b
commit
e01093b2ac
@ -13,12 +13,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { mapMutations, mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
todos () { return this.$store.state.todos.list }
|
||||
},
|
||||
computed: mapGetters({
|
||||
todos: 'todos/todos'
|
||||
}),
|
||||
methods: {
|
||||
addTodo (e) {
|
||||
var text = e.target.value
|
||||
|
@ -14,3 +14,9 @@ export const mutations = {
|
||||
todo.done = !todo.done
|
||||
}
|
||||
}
|
||||
|
||||
export const getters = {
|
||||
todos (state) {
|
||||
return state.list
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user