[Vuejs]-How to loop in vuejs

0👍

Here’s how to repeat the data only.


    <ul>
      <li v-for="service in responseObject.data" :key="service.service_id">
        {{ service.service_name }} :: {{ service.service_type }}
      </li>
    </ul>

0👍

You should try this.

<ul>
    <li v-for="service in responseObject.data">
        {{ service.service_name }}
    </li>
</ul>
<!-- OR -->
<ol>
    <li v-for="service in responseObject.data">
        {{ service.service_type }}
    </li>
</ol>

Also, I don’t know why you are still unable to get the data. I already get it here.

enter image description here

0👍

You can access the child "data" array by adding dot notation to your v-for statement ("responseObject.data")-

    <ul>
      <li v-for="service in  responseObject.data"    :key="service.service_id">
        {{ service.service_name }}
      </li>
    </ul>

Codepen – https://codepen.io/bsod_/pen/wvYwBrj

Leave a comment