由于某种原因,css样式不适用于React Modal。有什么理由吗?
render() {
return (
<div>
<Modal defaultOpen={this.props.isShowing} className="openmodal">
</Modal>
</div>
);
}
CSS文件
.openmodal{
text-align: center;
background-color: black;
border-radius: 0;
width: 400px;
position: relative;
}
答案 0 :(得分:1)
如果你想使用javascript样式,你可以像这样应用它;
const openmodal = {
content: {
textAlign: 'center',
backgroundColor: 'black',
borderRadius: '0',
width: '400px',
position: 'relative'
}
}
render() {
return (
<div>
<Modal defaultOpen={this.props.isShowing} style={openmodal}>
</Modal>
</div>
);
}
&#13;
尝试使用内联样式。
答案 1 :(得分:0)
它应该是portalClassName:
random
2018-01-01 1
2018-01-02 13
2018-01-07 26
答案 2 :(得分:0)