1👍
✅
The getSkills
action is performing an asynchronous request. You need to wait for the request to finish before you can access this.Skills
otherwise the data will not be set yet.
You need async
and await
(the “modern” solution):
async mounted() {
await this.getSkils();
this.id = this.$route.params.id;
this.Skills.forEach(element => this.skill_list.push(element.skill_name));
}
or:
mounted() {
this.getSkils().then(() => {
this.id = this.$route.params.id;
this.Skills.forEach(element => this.skill_list.push(element.skill_name));
});
}
Source:stackexchange.com