VUE监听滚动条事件

滚动条

 

created(){
    document.addEventListener('scroll', this.handleScroll)
  },
  beforeDestroy () {
    document.removeEventListener('scroll', this.handleScroll);
  },
  methods: {
    handleScroll(){
        var a = document.getElementsByClassName('ted-header')[0].offsetHeight;
        console.log(window.pageYOffset,a)
    },
}

 

posted @ 2020-08-21 18:01  泠风lj  阅读(2182)  评论(0编辑  收藏  举报