2👍
✅
I think you meant to put the v-for
on the <li>
instead of the <ul>
. If you put a ref
on an element that is repeated with v-for
, then it will be an array of the items.
<ul>
<li v-for="item in items" ref="items">{{ item.name }}</li>
</ul>
this.$refs.items[0]; // The first <li>
Source:stackexchange.com