0👍
According to the Vuex Docs, the mapState helper returns an object by default.
You are importing your states in an array. You can use object instead of array.
computed: {
...mapState({
currentSpeler: state => state. currentSpeler,
currentSpelerCard: state => state.currentSpelerCard,
currentGame: state => state.currentGame
}),
},
- [Vuejs]-Should @vue/composition-api be added in devDepencies
- [Vuejs]-Is there a way of displaying the value of an object inside an array?
0👍
I’d try to console log the currentGame and see what it looks like, then you can move on. My guess is that you somehow initialise the id parameter of currentGame while using the other component.
0👍
Found the error…
I have declared computed : { …} twice.
computed: {
...mapState([
'currentSpeler' ,'currentSpelerCard', 'currentGame',
]),
},
at the beginning of my script… and
computed: {
sec(){
if(this.totalTime.seconds < 10){
return '0'+this.totalTime.seconds;
}
return this.totalTime.seconds;
},
min(){
if(this.totalTime.minutes < 10){
return '0'+this.totalTime.minutes;
}
return this.totalTime.minutes;
}
},
the memorygame logic at the end of my script… overwriting the mapState…
Very silly…* bangs head on desk *
Source:stackexchange.com