Javascript 在使用internet explorer弹出窗口时创建了一个react应用程序,它可以在chrome、firefox或safari上正常工作,有任何建议吗
我使用react.js构建了一个应用程序,它看起来不错,但当我点击一个按钮弹出模式窗口后,它就坏了。我甚至查阅了CreateReact支持网站,发现react应用程序polyfill。可以让它工作。。。我那样做了,但没用 我做了react应用程序polyfill,但我的弹出模式窗口仍然会中断 在console.log之后没有出现错误Javascript 在使用internet explorer弹出窗口时创建了一个react应用程序,它可以在chrome、firefox或safari上正常工作,有任何建议吗,javascript,reactjs,Javascript,Reactjs,我使用react.js构建了一个应用程序,它看起来不错,但当我点击一个按钮弹出模式窗口后,它就坏了。我甚至查阅了CreateReact支持网站,发现react应用程序polyfill。可以让它工作。。。我那样做了,但没用 我做了react应用程序polyfill,但我的弹出模式窗口仍然会中断 在console.log之后没有出现错误 import React, { Component } from 'react'; import PropTypes from 'prop-typ
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Modal extends Component {
render() {
//console.log(this.props.itemInfo)
// Render nothing if the "show" prop is false
if (!this.props.show) {
return null;
}
// The gray background
const backdropStyle = {
position: 'fixed',
top: 0,
bottom: 0,
left: 0,
right: 0,
backgroundColor: 'hsl(0, 100%, 30%)',
padding: 50
};
// The modal "window"
const modalStyle = {
backgroundColor: '#fff',
margin: '25px auto',
padding: 30,
display: "flex",
height: "auto",
width: "auto",
flexWrap: "wrap",
textAlign: "center",
overflow: "auto",
};
const productImg = {
maxWidth: "600px"
}
const cardHeader = {
marginBottom: "20px"
}
const cardBody = {
height: "calc(100vh - 200px)",
overflow: "auto"
}
return (
<div className="backdrop" style={backdropStyle}>
<div className="modal" style={modalStyle}>
<div className="row">
<div className="col-12">
<div className="card">
<h6 className="card-header" style={cardHeader}>Item #
{this.props.itemInfo.item_no} - {this.props.itemInfo.item}</h6>
<div className="card-body" style={cardBody}>
<div className="row">
<div className="col-12"><img src= .
{this.props.itemInfo.image} alt="" style={productImg}></img></div>
</div>
<div className="row justify-content-center mt-3">
<div className="col-10" dangerouslySetInnerHTML={{
__html: this.props.itemInfo.description }} />
</div>
<div className="row justify-content-center mt-3">
<button className="btn btn-outline-primary"
onClick={this.props.onClose}>Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
Modal.propTypes = {
onClose: PropTypes.func.isRequired,
show: PropTypes.bool
};
export default Modal;
从“React”导入React,{Component};
从“道具类型”导入道具类型;
类模态扩展组件{
render(){
//console.log(this.props.itemInfo)
//如果“show”道具为false,则不渲染任何内容
如果(!this.props.show){
返回null;
}
//灰色背景
常量backdropStyle={
位置:'固定',
排名:0,
底部:0,
左:0,,
右:0,,
背景色:“hsl(0,100%,30%)”,
填充:50
};
//模态“窗口”
常数modalStyle={
背景颜色:“#fff”,
保证金:“25px自动”,
填充:30,
显示:“flex”,
高度:“自动”,
宽度:“自动”,
柔性包装:“包装”,
textAlign:“居中”,
溢出:“自动”,
};
const productImg={
最大宽度:“600px”
}
常量卡头={
marginBottom:“20px”
}
常数cardBody={
高度:“计算(100vh-200px)”,
溢出:“自动”
}
返回(
项目#
{this.props.itemInfo.item_no}-{this.props.itemInfo.item}
接近
);
}
}
Modal.propTypes={
onClose:PropTypes.func.isRequired,
show:PropTypes.bool
};
导出默认模式;
什么错误?你能提供更多细节吗?@valerii我没有收到任何错误。当我打开我的弹出模型窗口时,它就碎了。