Vue @scroll on vertical only

Viewed 430

Been searching and wasn't able to find the right solution for me. What I wanted to achieve is to trigger the @scroll functionality if and only the scroll is at the bottom of the element and when it's scrolled vertically only. This is the HTML:

<table @scroll="loadMoreData">
...
</table>

This is the Vue functionality:

loadMoreData({ target: { scrollTop, clientHeight, scrollHeight }}) {
     if (scrollTop + clientHeight >= scrollHeight) {
         // load more data here...
     }
},

This is working fine but the problem with this is it also triggers when scrolled horizontally. How to trigger this when scrolled vertically only? Thanks.

0 Answers
Related