I get syntax error when combining Vuex localcomputed object with get/set together with store mappings.
As seen in the Vuex docs you can map your store methods like this with the object spread operater like:
computed: {
localComputed () { /* ... */ },
// mix this into the outer object with the object spread operator
...mapState({
// ...
})
}
https://vuex.vuejs.org/en/state.html##object-spread-operator
Also you can create computed setters like:
computed: {
fullName: {
// getter
get: function () {
return this.firstName + ' ' + this.lastName
},
// setter
set: function (newValue) {
var names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
}
}
}
https://vuejs.org/v2/guide/computed.html#Computed-Setter
I can create either a computed object with get set or have mapState/mapGetters etc. - but not in combination. It break the syntax (error is: expected function name after the function declarations).
computed: {
localComputed () {
localMethod: {
get: function () {
// retrieve
},
set: function (newContent) {
// set
}
}
}, ...mapState([
]), ...mapGetters([])
}
How do i combine these two?