Answer the question
In order to leave comments, you need to log in
How to loop through all the properties of an object in an array?
data: function () {
return {
address: [
{
flat: 0,
house: 0,
street: 0,
settlements: 0,
municipality: 0,
edge: 0
},
{
flat: 0,
house: 0,
street: 0,
settlements: 0,
municipality: 0,
edge: 0
}
]
}
},
methods: {
paintLine() {
for(var prop in this.address[0]) {
console.log(prop + ':' + this.address[0].prop);
}
}
}
Answer the question
In order to leave comments, you need to log in
Obviously, you are trying to get the 'prop' field from the object. upd.
Don't forget to check if these are private properties of the object (hasOwnProperty)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question