拉下加载更多

componentDidMount(){

//获取列表数据

  this.getListData();

  // 下拉刷新

  let all = document.documentElement.scrollHeight || document.body.scrollHeight;

  let top = document.documentElement.scrollTop || document.body.scrollTop;

  let height= document.documentElement.clientHeight || document.body.clientHeight;

  window.addEventListener('scroll',()=>{

    if(all === top+height){

      this.setState({

        page: this.state.page +1,

      })

      this.getListData()

    }

  },false)

  // console.log(this.url)

}

你可能感兴趣的:(拉下加载更多)