I'm trying to create an array elections as a computed property within my vuejs component, by adding some more UI relevant information to the array elections of my datastore.
export default {
computed: {
data() {
var elections = [];
this.$dataStore.state.elections.forEach((el) => {
console.log(this);
var election = { id:el.id, icon: 'assignment', iconClass: 'blue white--text', title: el.title, subtitle: 'Jan 20, 2018' };
this.elections.push(election);
});
return {
elections: this.elections
}
}
}
}
However, I'm getting a "Cannot read property 'push' of undefined"" error. What is wrong here?