mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Waterfall bind event repeated
This commit is contained in:
parent
a6906b06f1
commit
20e8145e1b
@ -6,6 +6,11 @@ const OFFSET = 300;
|
||||
// 绑定事件到元素上
|
||||
// 读取基本的控制变量
|
||||
function doBindEvent() {
|
||||
if (this.el[CONTEXT].binded) {
|
||||
return;
|
||||
}
|
||||
this.el[CONTEXT].binded = true;
|
||||
|
||||
this.scrollEventListener = Utils.debounce(handleScrollEvent.bind(this), 200);
|
||||
this.scrollEventTarget = Utils.getScrollEventTarget(this.el);
|
||||
|
||||
@ -52,7 +57,7 @@ function handleScrollEvent() {
|
||||
needLoadMoreToLower = elementBottom - targetVisibleHeight < this.offset;
|
||||
}
|
||||
if (needLoadMoreToLower) {
|
||||
this.cb['lower'] && this.cb['lower']({ target: scrollEventTarget, top: targetScrollTop });
|
||||
this.cb.lower && this.cb.lower({ target: scrollEventTarget, top: targetScrollTop });
|
||||
}
|
||||
|
||||
// 判断是否到了顶
|
||||
@ -64,7 +69,7 @@ function handleScrollEvent() {
|
||||
needLoadMoreToUpper = elementTop + this.offset > 0;
|
||||
}
|
||||
if (needLoadMoreToUpper) {
|
||||
this.cb['upper'] && this.cb['upper']({ target: scrollEventTarget, top: targetScrollTop });
|
||||
this.cb.upper && this.cb.upper({ target: scrollEventTarget, top: targetScrollTop });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user