Skip to main content
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Vue Iteration inside element

I am attempting to iterate through an array from a Vue component without reapeating the element on which I call 'v-for'. I have not found a subsitute for 'v-for' in the official docs API, nor in articles online.

I have this:

<div v-for="(item, index) in items">
  <foo :index="index">
  <foo/>
</div>

Want this:

<foo :index="0"><foo/> 

<foo :index="1"><foo/>

<foo :index="2"><foo/>
//etc...

And have tried this, which does not work:

<foo v-for="(item, index) in items":index="index">
<foo/>

Help is much appreciated! Started coding with Vue.js yesterday.

Answer*

Cancel

Morty Proxy This is a proxified and sanitized view of the page, visit original site.