tangdaohai / vue-happy-scroll

基于vue2.0实现的滚动条插件。scroll component for vue2.0

Home Page:https://tangdaohai.github.io/vue-happy-scroll/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

如何获取滚动条的translate值,即他y轴滚动条滑动的距离

zzzyuan0 opened this issue · comments

@1537069101 y 轴滚动条距离顶部的距离? -> https://github.com/tangdaohai/vue-happy-scroll#scroll-top

@1537069101 y 轴滚动条距离顶部的距离? -> https://github.com/tangdaohai/vue-happy-scroll#scroll-top

我获取这个值,他一直都是为0,其实我只想监听滚动条滚动时,他距离最上面的距离有多远,其实 v-on:scroll.passive="handleScroll"这个功能可以满足我的要求,但是他没有任何效果

@1537069101 y 轴滚动条距离顶部的距离? -> https://github.com/tangdaohai/vue-happy-scroll#scroll-top

我现在已经好了需要加一条这个
mounted:function() {
window.addEventListener('scroll', this.handleScroll,true)
},

@1537069101 如图,当前 TOP 是你的需求吧?可以查看此 demo
image

@1537069101 使用方式的问题:<happy-scroll :scroll-top="scrollTop" ==> <happy-scroll :scroll-top.sync="scrollTop" 需要增加 sync 修饰符,获取同步 scrollTop 的 value。