Created
April 7, 2016 05:15
-
-
Save logzh/c86574f7e5087ee6f8be8e1c659fb1b7 to your computer and use it in GitHub Desktop.
react 底部向上滑动获取更多数据
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//console.log(window.scrollY) // 文档在垂直方向已滚动的像素值。 | |
//console.log(window.innerHeight) // 浏览器窗口的视口(viewport)高度(以像素为单位) | |
//console.log(document.body.scrollHeight) | |
//console.log(window.scrollY) | |
_.debounce(function() { | |
var props = this.props; | |
if (typeof window !== 'undefined') { | |
if (!props.isFetchingList && props.hasMorePosts && (document.body.scrollHeight - window.innerHeight - window.scrollY) <= 100) { | |
props.actions.fetchThreadReply(props.id, props.posts.length); | |
} | |
} | |
}, 500), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment