vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

Computed property $index value in v-repeat #367

Open Mat-Moo opened 9 years ago

Mat-Moo commented 9 years ago

Probably missing something simple, but I need to know what the current index of a v-repeat is for a computed variable. This will return (Depending on another option) a bullet with A/B/C or 1/2/3 etc. (Based on that index). Originally I thought this was to do with caching because this.$index (In a component) was showing 0, but adding cache:false just shows this.$index as 0 twice now (So I know it's being called correctly).

young-steveo commented 9 years ago

@Mat-Moo Need a reproduction in order to debug it.

Mat-Moo commented 9 years ago

Not a bug it's a question, how can I access the current $index of a v-Repeat (now v-for) in a computed variable?

jonathanpmartins commented 9 years ago

same doubt here! :+1: @Mat-Moo

mayureshnw commented 8 years ago

Hey, I had the same question, wasnt able to find anything on the forums as well. Would be great help if you could answer this