0👍
“this.datas.forEach is not a function”
This mean that datas
is not an Array instance because forEach
is method from array prototype.
0👍
Right now, this.datas
does not exist. You never give this the state with the key datas
.
It looks like you’re trying to go through this.test
, which is an array of objects. Is that right?
If that’s the goal, you can do so:
data() {
return {
postForm: this.$vform({}),
test: [{"name":"Couleur yeux","id":3,"answer":null},{"name":"Hanches","id":6,"answer":"'Test'"}],
}
},
methods: {
createForm() {
let arrayOfAnswers = []
this.test.forEach((data) => {
if (data.answer) {
arrayOfAnswes.push(data.answer)
}
})
this.arrayOfanswers = arrayOfAnswers
}
},
- [Vuejs]-Electron adding files to public folder after build fails
- [Vuejs]-Can't access component's methods with vue js
Source:stackexchange.com