VueJs - How to access DOM property of an element from $refs

Viewed 16468

I have an element

<tbody ref="tbody">
  <tr class="row" :ref="userIndex" v-for="(userData, uid, userIndex) in users" :key="uid">

in my template. I need to access/edit the DOM property like scrollTop, verticalOffset of <tr> element. How can I achieve this?

I have tried to access using this.$refs[userIndex][0].$el but its not working. I can see all the properties in the console but I am unable to access them. However this.$refs.tbody.scrollTop works.

Below is the snap showing console.log(this.$refs)enter image description here

console.log(this.$refs[userIndex]) enter image description here

console.log(this.$refs[userIndex][0]) enter image description here

As you can see when I use this.$refs[userIndex][0] I don't see the DOM properties

2 Answers
Related