使用插件better-scroller
使用手册:
html结构:
<div class="scroll-wrapper">
<div class="content">
<!--以下就是滑块内的内容了-->
<ul class="list">
<li>
这里写内容就行了
</li>
</ul>
</div>
</div>
js
//在vue中的created中调用这两个方法即可
createScroller() {
this.scroller = new BScroll(this.$refs.scroller, {
click: true,
probeType: 3
});
},
bindEvents() {
var scrollTop = this.$refs.scroller.scrollTop;
let that = this;
this.scroller.on("scrollEnd", e => {
localStorage.getItem("scrollY") && localStorage.removeItem("scrollY");
this.scrollY = e.y;
});
this.scroller.on("scroll", e => {
this.searchMove = e.y < -4;
this.searchBg = e.y < -96;
this.pullDownRefresh = e.y > 40;
});
this.scroller.on("touchEnd", e => {
//请求
}
网友评论