React:下拉列表滚动触发(onPopupScroll)使用方法
直接上代码:
handleByPopupScroll = (e) => {
let {target} = e
//当前滚动到的位置
let start = target.scrollTop + target.offsetHeight
//最后的位置
let ned = target.scrollHeight
//滚动到顶部
if(target.scrollTop == 0){
//处理逻辑......
}else{
//滚动底部
if(start == end){
//处理逻辑.....
}
}
}
render(){
return (
<Select
onPopupScroll={this.handleByPopupScroll}
>
<Select.Option value="1">1</Select.Option>
<Select.Option value="1">1</Select.Option>
</Select>
)
}