[Vuejs]-Access Object in VueJS

0👍

your properties is a object then you don’t need loop it as a array.
just you can access directly to his properties:

<v-timeline-item
  v-for=" activity in activities"
  :key="activity.id"
>
  <v-card class="elevation-2">vue
      <v-card-text>
          {{ activity.description }}

          <span>
              {{ activity.properties.attributes.name }}
          </span>

          {{ getMoment(activity.properties.attributes.created_at) }}
      </v-card-text>
  </v-card>
</v-timeline-item>

0👍

That’s because you are looping over properties object.

v-for="(attr, index) in activity.properties" :key="index"

According to your pic, properties object has attributes and old keys. Looping over it will mean that you want the name property displayed for both keys.

Consider changing your code to:-

<span>{{ activity.properties.name }}</span>

Leave a comment