【问题标题】:React react-tap-event-plugin firing event twice with mouse click用鼠标点击两次反应 react-tap-event-plugin 触发事件
【发布时间】:2016-03-29 22:41:56
【问题描述】:

我正在尝试使用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 方法会触发两次。

编辑:检查事件后,似乎触发了“mouseup”事件,紧接着是“click”事件。

【问题讨论】:

标签: javascript ios events reactjs


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多