[Vuejs]-Vue: Interpolating a dynamic number of props?

1👍

Like @yuriy636 also proposed, I would suggest you pass an array of objects named “boxes”.

If you assume boxes looks like this:

[
 {title: "Hi"},
 {title: "Foo"},
 {title: "Test"}
]

You can simply do this:

// Parent

<div>
   <box-component :boxes="boxes"/>
</div>

//BoxComponent

   <div v-for="box in boxes">
       <div class="title">
           {{ box.title }}
       </div>
   </div>
👤SebSob

Leave a comment