在反应网格布局中覆盖 onMouseDown
Overriding onMouseDown in react-grid-layout
如何覆盖 GridItem 的 onMouseDown?
我有这样的东西:
class TrackItem extends React.Component {
onMouseDown(e) {
this.props.onMouseDown.apply(e);
}
render() {
return <div onMouseDown={this.onMouseDown.bind(this)}>item</div>;
}
}
产生错误:
react-draggable.js:1050 Uncaught TypeError: Cannot read property 'button' of undefined
原来我不需要apply
:
this.props.onMouseDown(e);
如何覆盖 GridItem 的 onMouseDown?
我有这样的东西:
class TrackItem extends React.Component {
onMouseDown(e) {
this.props.onMouseDown.apply(e);
}
render() {
return <div onMouseDown={this.onMouseDown.bind(this)}>item</div>;
}
}
产生错误:
react-draggable.js:1050 Uncaught TypeError: Cannot read property 'button' of undefined
原来我不需要apply
:
this.props.onMouseDown(e);