版本:2.2.2
因为无法监听到 scroll-to-bottom 事件,查了一下是这个版本没得修改,后面的应该是ok的了
所以简单改了下源码
路径:自己的安装位置/。。。
//
if (realMove.y > 0) { //up
let icBottomPos = this.content.y - this.content.anchorY * this.content.height;
if (icBottomPos + realMove.y >= this._bottomBoundary) {//这里改为 >=
scrollEventType = 'scroll-to-bottom';
}
}
还有因为是简单的修改,就还是用的默认引擎脚本,这个需要留意一下。
然后手动改了下,这里的地方,因为你不编译它,它是不会生效的
构建的:
预览的:
改完就能监听到了。
this.node.on("scroll-to-bottom", (event: cc.Event.EventTouch) => {
console.log("上滑移动到底部了:" + self.node.y);
}, this)
PS:吐槽一下这些个事件还没得封装还得自己找一下~
参考: