Subscribe on changes!

Components inside <teleport> are getting the wrong index from for loop

avatar
May 3rd 2021
<div v-for="(item, index) in collection">
 <teleport to="body">
   <button @click="action(index)">Click me</button>
 </teleport>
</div>

So the index that is being used is always the last item in the loop, am I missing something?

avatar
May 3rd 2021

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

avatar
Aug 9th 2021

@smasinde Hi mate, does the wrong index issue been solved?

avatar
Aug 9th 2021

works fine see sfc

avatar
Aug 9th 2021

@edison1105 Thanks for your example. Figured out the bug in my code finally.