[Vuejs]-Creating a loop to loop over the componennt created

0👍

You’re very close. Given your data, the template would need to look like:

<div v-for="(option, index) in options" :key="index">
  <h3>{{ option.heading }}</h3>
  <p>{{ option.subheading}}</p>
</div>

Or, if you’ve got a custom component, which takes heading and subheading as props:

<componentName
  v-for="(option, index) in options"
  :key="index"
  :heading="option.heading"
  :subheading="option.subheading"
/>

If you can share a bit more of your code, I can create a runnable snippet, if that would be helpful.

Leave a comment