From 31db790e90a57b785286247c4564aa59eaed13de Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 13 Nov 2019 14:53:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=A4=B8=E5=85=8B?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8A=E6=8B=89=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/bridge/subscribe/scroll.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/view/bridge/subscribe/scroll.js b/src/core/view/bridge/subscribe/scroll.js index e28aacf1cf..2250965d5f 100644 --- a/src/core/view/bridge/subscribe/scroll.js +++ b/src/core/view/bridge/subscribe/scroll.js @@ -59,6 +59,8 @@ export function pageScrollTo ({ } let testReachBottomTimer +let lastScrollHeight = 0 + export function createScrollListener (pageId, { enablePageScroll, enablePageReachBottom, @@ -79,7 +81,10 @@ export function createScrollListener (pageId, { const windowHeight = window.innerHeight const scrollY = window.scrollY 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 return true } -- GitLab