vue scroll事件

    handleScroll(e) {
      const scrollTop = e.target.scrollTop
      const windowHeight = e.target.clientHeight
      const scrollHeight = e.target.scrollHeight
      if (scrollTop + windowHeight >= scrollHeight) {
        console.log('到达底部了')
      }
      if (scrollTop === 0 && this.oldv !== 0) {
        console.log('到达头部了')
      }
    },

 

posted @ 2022-12-12 09:51  zy-lzh  阅读(32)  评论(0)    收藏  举报