【发布时间】:2019-07-18 02:52:55
【问题描述】:
我在我们制作的网站上发现了一个错误,我不知道如何调试。目前正在尝试使用 GhostLab 应用程序进行调试。
问题
在应用浏览器的 iOS Instagram 中访问此网站时,任何 onClick 事件都不起作用。
应用程序在移动 safari、桌面浏览器上完美运行。
标题图标代码
<i className="fas fa-shopping-bag" onClick={() => this.props.activeCartDropdown()} />
<i className="fas fa-bars" onClick={() => this.props.activeHeaderDropdown()} />
常见问题代码
import React from 'react';
import PropTypes from 'prop-types';
import { Link, NavLink, withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import Bootstrap from 'bootstrap';
import Helmet from 'react-helmet';
import history from '/client/history';
class BrandAmbassadorFAQ extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false
}
}
render() {
return (
<div className={`faq ${this.state.open}`} onClick={() => this.setState({ open: !this.state.open })}>
<div className="question">
{this.props.question}
</div>
<div className="answer">
{this.props.answer}
{this.props.image &&
<img src={this.props.image} className={`img-fluid ${this.props.image_size ? this.props.image_size : ''}`}/>
}
</div>
</div>
)
}
}
export default BrandAmbassadorFAQ;
应用详情和版本
Meteor 1.8.0.2
React 16.4.2
@babel/runtime 7.3.1
【问题讨论】:
-
您可以尝试将图标移动到
button并将onClick添加到按钮中吗? -
已经尝试过了。网站上的任何 onClick 事件都已停止运行 [包括产品详细信息添加到购物车,它们是按钮]。我还在 CSS 中添加了
cursor: pointer -
目前正在将
@babel/runtime降级为:@babel/runtime@7.0.0-beta.55,看看是否与babel版本和箭头函数有关在onClick里面
标签: javascript reactjs meteor instagram inappbrowser