wilded
4/29/2019 - 2:50 PM

Getting DOM elements of $refs from Vue.js in a v-for

<td v-for="(item, index) in array" :key="index" ref="referenceItem" @mouseenter="updateClass(index)" >

updateClass(index: number) {
    const tdItem: any = this.$refs.referenceItem;
    referenceItem[index].className = 'new-class';
  }