美文网首页
VUE监听页面滚动事件

VUE监听页面滚动事件

作者: coderfl | 来源:发表于2020-12-29 17:49 被阅读0次
mounted() {
    const scr = document.querySelector('.scroll')
    scr.addEventListener('scroll', this.handleScroll)
  },
 methods: {
    handleScroll() {
      const scr = document.querySelector('.scroll')
      const scrollT = scr.scrollTop
      console.log(scrollT)
    }
}

相关文章

网友评论

      本文标题:VUE监听页面滚动事件

      本文链接:https://www.haomeiwen.com/subject/csfsgktx.html