VUE监听内部元素滚动时报错Cannot read property 'addEventListener' of null",代码如下:
mounted () {
this.$nextTick(function () {
let targetScroll = document.getElementById("dialogScroll")
targetScroll.addEventListener('scroll', this.handleScroll)
});
},
methods: {
handleScroll (){
this.scrollTop = document.getElementById("dialogScroll").scrollTop
console.log(this.scrollTop)
},
},