[Vuejs]-V-for with nested objects in array

0👍

My bad. I thought I read the data carefully, but in fact I didn’t.

I would say there’s no issue in displaying properties of nested objects with v-for, just it’s crucial we know exactly what we’re trying to display in every loop.

In my case I didn’t notice that the object properties were not always the same (for example trip_instance wasn’t a property of all the objects in the array, this was breaking the loop).

So, hoping to help someone, if you run into issues with v-for or iteration in general, make sure you know exactly the data structure you’re working with.
Hope I got it too, once for all.

Thanks @djiss for your time and trying to help.

3👍

Vue does not allow dynamically adding new root-level reactive properties to an already created instance. However, it’s possible to add reactive properties to a nested object using the Vue.set(object, propertyName, value) method:

Vue.set(vm.someObject, 'b', 2)
// interchangeably 
this.$set(vm.someObject, 'b', 2)

More information here

Leave a comment