用鼠标点击两次反应react-tap-event-plugin触发事件

时间:2016-03-29 22:41:57

标签: javascript ios events reactjs

我尝试使用https://github.com/zilverline/react-tap-event-plugin消除iphone点击事件的300毫秒延迟,但是在用鼠标点击我的元素后,事件会触发两次。这是我的代码:

在我的主app.js文件中:

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方法将触发两次。

编辑:检查事件后,似乎是一个&#34; mouseup&#34;事件被触发,然后直接点击&#34;点击&#34;事件

1 个答案:

答案 0 :(得分:0)

如果您使用的是onTouchTap,请不要使用onClick

相关问题