[Vuejs]-Get a property from an array that is in a json, with vuejs

0👍

Polygons is an array, so to get the 1st item:

<span v-if="event.polygons.length !== 0"><i class="ti-location-pin"></i> {{event.polygons[0].name}}</span>

Or iterate over it:

<span v-if="event.polygons.length !== 0" v-for="polygon in event.polygons"><i class="ti-location-pin"></i> {{polygon.name}}</span>

Leave a comment