componentDidMount() {
const loadMoreFn = this.props.loadMoreFn
const wrapper = this.refs.wrapper
let timeoutId
function callback(){
const top = wrapper.getBoundingClientRect().top
console.log(top)
const windowHeight = window.screen.height
if(top && top<windowHeight) {
// 当 wrapper 已经被滚动到可视范围内了
loadMoreFn()
}
}
window.addEventListener('scroll', function() {
if(this.props.isLoadingMore) {
retrun
}
if(timeoutId) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(callback, 50)
}, bind(this), false)