Answer the question
In order to leave comments, you need to log in
Why does $refs on v-for return an array?
https://github.com/vuejs/vue/issues/4952
In theory, the result should be like this in refs
ref-1: <element>
ref-2: <element>
..
ref-1: [
0: <element>
]
ref-2: [
0: <element>
]
..
<div :key="index"
:ref="`item:${index}`"
v-for="(value,index) in listItems"
>
Best I've come up with is assigning a different unique ref name for each item in the list like :ref="'option:' + item.id" but that's really gross, especially considering I have to access that ref as element 0 of an array with only one item in it now since the ref is on a v-for.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question