【发布时间】:2017-07-07 03:37:57
【问题描述】:
我有一个简单的反应组件,我为该组件设置了 onScroll 事件,但是当我滚动它时它没有触发
import React, { Component, PropTypes } from 'react'
export default class MyComponent extends Component {
_handleScroll(e) {
console.log('scrolling')
}
render() {
const style = {
width: '100px',
height: '100px',
overflowY: 'hidden'
}
const innerDiv = {
height: '300px',
width: '100px',
background: '#efefef'
}
return (
<div style={style} onScroll={this._handleScroll}>
<div style={innerDiv}/>
</div>
)
}
}
【问题讨论】:
标签: javascript reactjs scroll