Back to our BlogMap component; we can use the helpers to map the getters and the actions:
import { createNamespacedHelpers } from 'vuex'
const {
mapGetters,
mapActions,
} = createNamespacedHelpers('maps')
export default {
computed: {
...mapGetters([
'center',
'zoom',
]),
mapOptions () {
// ...
},
},
methods: mapActions([
'setCenter',
'setZoom',
]),
}
Now the state of the map is managed in the Vuex store!