I am struggling to loop through an array in a Vue component without duplicating the element specified in the 'v-for' directive. I have consulted the official Vue.js API documentation, as well as various online articles, but haven't found a suitable alternative for achieving this.
Here is my current code:
<div v-for="(item, index) in items">
<foo :index="index">
<foo/>
</div>
Desired output:
<foo :index="0"><foo/>
<foo :index="1"><foo/>
<foo :index="2"><foo/>
//etc...
I have attempted the following code, but it does not work as expected:
<foo v-for="(item, index) in items":index="index">
<foo/>
Any assistance would be greatly appreciated! I only just started working with Vue.js yesterday.