0๐
If I understand you correctly, you are trying to parse a property into a component, then loop through this property and assign it to the local data storage using a forEach loop,
Here is a example Fiddle: https://jsfiddle.net/eywraw8t/70166/
Vue.component('child', {
props: ['data'],
data: function() {
return {
'newItems': [],
}
},
mounted: function(){
this.data.forEach((input) => {
this.newItems.push(input.data)
});
console.log(this.newItems)
},
template: `<div>{{ newItems }}</div>`
});
new Vue({
el: "#app",
data() {
return {
data: [
{ 'data': 123, 'other': 678 },
{ 'data': 233, 'other': 6728 },
{ 'data': 343, 'other': 67812 },
]
}
}
});
Source:stackexchange.com