尝试了很多中方法,用下面代码实现了
componentDidMount(){
window.addEventListener('scroll', this.handleScroll);
}
handleScroll(){
console.log(window.scrollY)
}
尝试了很多中方法,用下面代码实现了
componentDidMount(){
window.addEventListener('scroll', this.handleScroll);
}
handleScroll(){
console.log(window.scrollY)
}