vue 自定义 滚动条指令

Posted tutao1995

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue 自定义 滚动条指令相关的知识,希望对你有一定的参考价值。

Vue.directive(‘scroll‘, {
  bind: (el, binding, vnode) => {
    // 是否执行回调事件
    let eventAction = true
    // 距离底部剩余距离开始触发回调
    let distance = 100 // (unit: px)
    // 监听滚动事件
    el.onscroll = (e) => {
      binding.value()
    } 
  }
})

以上是关于vue 自定义 滚动条指令的主要内容,如果未能解决你的问题,请参考以下文章