[Vuejs]-VuexFire: how to combine computed: and computed()

2👍

First of all, you will always specify your computed properties as an object, not as a method (as you’re doing with computed()).

Secondly, you need to use the spread operator in the computed object:

computed: {
  amethod() { return 1 },
  ...Vuex.mapGetters(['todos'])
}

This effectively spreads out all of the computed property methods returned by Vuex.mapGetters and defines them as properties of the computed object.

Leave a comment