js 监听组件滚动事件

内容
const box = document.querySelector('#box')

box.addEventListener('scroll', function(e) {
  const scrollTop = e.target.scrollTop
  const clientHeight = e.target.clientHeight
  const scrollHeight = e.target.scrollHeight

  if (scrollHeight === scrollTop + clientHeight && this.list.length !== this.total) {
    this.listQuery.pageNo++
    this.listResourcePage()
  }
})

你可能感兴趣的:(js 监听组件滚动事件)