当前位置: 移动技术网 > IT编程>脚本编程>vue.js > vue 监听滚动条移动参数

vue 监听滚动条移动参数

2020年07月17日  | 移动技术网IT编程  | 我要评论

@scroll实现
首先有滚动条的div一定要设固定高度,然后overflow:auto;出现滚动条
passive是使滚动更加流畅,减少卡顿,

 

 <!-- 搜索联想弹框 -->
<div class="SearchAssociationBox" @scroll.passive="getScroll($event)"></div>

 

    getScroll(event) {
      // 滚动条距离底部的距离scrollBottom
      let scrollBottom =
        event.target.scrollHeight -
        event.target.scrollTop -
        event.target.clientHeight
      console.log('scrollBottom :>> ', scrollBottom)
      if (scrollBottom < 28) {
        this.currentPage += 1
        this.getPlatformInfo()
      }
    }


 

本文地址:https://blog.csdn.net/qq_37939251/article/details/107381730

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网