_initScroll(){
this
.$nextTick(() => {
if
(!
this
.scroll) {
this
.scroll =
new
BScroll(
this
.$refs.bscroll, {
click:
true
,
scrollY:
true
,
probeType: 3
});
}
else
{
this
.scroll.refresh();
}
this
.scroll.on(
'scroll'
, (pos) => {
console.log(pos.y,
this
.dropDown)
//如果下拉超過50px 就顯示下拉刷新的文字
if
(pos.y>50){
// 顯示刷新的element this.xxx = true;
}
else
{
// 隱藏刷新的element this.xxx = false;
}
})
//touchEnd(手指離開以后觸發) 通過這個方法來監聽下拉刷新
this
.scroll.on(
'touchEnd'
, (pos) => {
// 下拉動作
if
(pos.y > 50){
console.log(
"下拉刷新成功"
)
// 隱藏刷新的element this.xxx = false;
}
//上拉加載 總高度>下拉的高度+10 觸發加載更多
if
(
this
.scroll.maxScrollY>pos.y+10){
console.log(
"加載更多"
)
//使用refresh 方法 來更新scroll 解決無法滾動的問題
this
.scroll.refresh()
}
console.log(
this
.scroll.maxScrollY+
"總距離----下拉的距離"
+pos.y)
})
console.log(
this
.scroll.maxScrollY)
});
}
