Answer the question
In order to leave comments, you need to log in
Why can't ...mapGetters be unpacked into data?
Why do you need to unpack in computed , and not like this, for example:
export default {
data(){
return{
...mapGetters([
'doneTodosCount',
'anotherGetter'
// ...
])
}
}
};
Answer the question
In order to leave comments, you need to log in
From the vuex docks , the mapGetters
function simply proxies the store getters into the component's local computed properties.
That is, it turns intomapGetters(['doneTodosCount'])
{
doneTodosCount() {
return this.$store.getters.doneTodosCount;
},
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question