React Click 事件未在移动设备上触发 [英] React Click events not firing on mobile

查看:50
本文介绍了React Click 事件未在移动设备上触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 react 几个月了,但刚刚遇到了一些奇怪的事情.

在移动设备上根本没有触发点击事件:

http://jsbin.com/morarewelu/1/edit?html,js,输出

http://jsbin.com/morarewelu/1/ - 检查您的设备>

您可以看到点击从未被触发.在此处在 iphone 上进行测试.

这是预期的行为,还是只是一个错误?

解决方案

React 的 Github 项目中有一些问题可能会有所帮助.

看起来,您需要添加一个 CSS cursor:'pointer' 以便手机(特别是 iOS 设备)在元素上触发原生点击事件.

I've been working with react for a couple of months now, but have just run into something a little weird.

Click events aren't being fired at all on mobile devices:

http://jsbin.com/morarewelu/1/edit?html,js,output

http://jsbin.com/morarewelu/1/ - Check on your device

You can see that the click is never fired. Testing on iphone here.

Is this expected behaviour, or simply a bug?

解决方案

There are a few issues in React's Github project which might be helpful.

Looks like, you need to add a CSS cursor:'pointer' so that mobile phones (iOS devices specifically) fire native click event on the element.

这篇关于React Click 事件未在移动设备上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆