Javascript 用鼠标点击两次反应点击事件插件触发事件
我试图用它来消除iphone点击事件的300毫秒延迟,但用鼠标点击我的元素时,事件会触发两次。这是我的密码: 在我的主app.js文件中:Javascript 用鼠标点击两次反应点击事件插件触发事件,javascript,ios,events,reactjs,Javascript,Ios,Events,Reactjs,我试图用它来消除iphone点击事件的300毫秒延迟,但用鼠标点击我的元素时,事件会触发两次。这是我的密码: 在我的主app.js文件中: import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin({ ignoreMouseThreshhold: 1000 //I've tried with and without this }); 在我的组件中: <th onTouch
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin({
ignoreMouseThreshhold: 1000 //I've tried with and without this
});
在我的组件中:
<th
onTouchTap={ this.handleTap.bind(this); }
onClick={ this.handleTap.bind(this); }>
当从计算机鼠标单击元素时,handleTap方法将触发两次
编辑:检查事件后,似乎触发了一个“mouseup”事件,紧接着是一个“click”事件。如果使用的是
onTouchTap
请不要使用onClick
您使用的是哪一版本的react?0.14.7--如果我删除click处理程序,它似乎可以工作,但可能会重复