提交 fcbae235 编写于 作者: Q qiang

Merge branch 'fix-onpagescroll' into dev

......@@ -39,7 +39,7 @@ function updateCssVar (vm) {
}
}
export default function initSubscribe (subscribe) {
export default function initSubscribe (subscribe) {
Object.keys(subscribeApis).forEach(name => {
subscribe(name, subscribeApis[name])
})
......@@ -88,10 +88,10 @@ export default function initSubscribe (subscribe) {
onReachBottomDistance,
enableTransparentTitleNView
})
setTimeout(function () { // 避免监听太早,直接触发了 scroll
requestAnimationFrame(function () { // 避免监听太早,直接触发了 scroll
document.addEventListener('scroll', scrollListener)
}, 10)
})
}
})
}
}
}
......@@ -91,6 +91,10 @@ export function createScrollListener (pageId, {
}
function trigger () {
const pages = getCurrentPages()
if (!pages.length || pages[pages.length - 1].$page.id !== pageId) {
return
}
// publish
const scrollTop = window.pageYOffset
if (enablePageScroll) { // 向 Service 发送 onPageScroll 事件
......@@ -121,4 +125,4 @@ export function createScrollListener (pageId, {
}
ticking = true
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册