2017-10-28 64 views

回答

1

我想,你應該使用鴨子類型,例如只有MouseEvents有pageX屬性,pageY屬性,所以

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

鍵盤事件有語言環境,位置

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

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

相關問題