1.申明函数:
function preventBackgroundScroll(e: React.WheelEvent){
const target = e.currentTarget if ( (e.deltaY < 0 && target.scrollTop <= 0) || (e.deltaY > 0 && target.scrollHeight - target.clientHeight - target.scrollTop <= 0) ) { e.stopPropagation() e.preventDefault() } }2.调用函数:
<div onWheel = {this.state.lodding ? this.preventBackgroundScroll : null}>