我是reactjs的新手。我无法单击ipad上的任何下拉菜单选项。但是在桌面上可以单击。下面是代码段,
<div className="dropdown_contents">
{React.Children.map(
contents,
(child, index) => { return (
child && <div
key={index}
onClick={this.click_item}
onTouchStart={this.click_item}>{child}
</div>);}
)}
click_item = (event) => {
event.stopPropagation();
const first_option = event.target.children[0];
if (first_option && !first_option.contains(event.target)) {
first_option.click();
first_option.ontouchstart(event);
}
我已经使用onTouchStart事件来处理ipad上的触摸事件。我不确定为什么这不起作用,或者我是否以正确的方式使用touchstart事件。有人可以帮我这个忙。谢谢。