2017-10-28 31 views

回答

1

我想,你应该使用鸭子类型,例如只有MouseEvents有pageX属性,pageY属性,所以

if (e.pageX || pageY) -> MouseEvent 

键盘事件有语言环境,位置

if (e.locale || location) -> KeyboardEvent 

你可以找到的官方文档中的所有差异:https://reactjs.org/docs/events.html#supported-events

相关问题