提交 31db790e 编写于 作者: Q qiang

fix: 解决夸克浏览器上拉加载无法触发的问题

上级 d9f85763
...@@ -59,6 +59,8 @@ export function pageScrollTo ({ ...@@ -59,6 +59,8 @@ export function pageScrollTo ({
} }
let testReachBottomTimer let testReachBottomTimer
let lastScrollHeight = 0
export function createScrollListener (pageId, { export function createScrollListener (pageId, {
enablePageScroll, enablePageScroll,
enablePageReachBottom, enablePageReachBottom,
...@@ -79,7 +81,10 @@ export function createScrollListener (pageId, { ...@@ -79,7 +81,10 @@ export function createScrollListener (pageId, {
const windowHeight = window.innerHeight const windowHeight = window.innerHeight
const scrollY = window.scrollY const scrollY = window.scrollY
let isBottom = scrollY > 0 && scrollHeight > windowHeight && (scrollY + windowHeight + onReachBottomDistance) >= scrollHeight let isBottom = scrollY > 0 && scrollHeight > windowHeight && (scrollY + windowHeight + onReachBottomDistance) >= scrollHeight
if (isBottom && !hasReachBottom) { // 兼容部分浏览器滚动时scroll事件不触发
const heightChanged = Math.abs(scrollHeight - lastScrollHeight) > onReachBottomDistance
if (isBottom && (!hasReachBottom || heightChanged)) {
lastScrollHeight = scrollHeight
hasReachBottom = true hasReachBottom = true
return true return true
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册