我使用的引导模态分量从here反应过来,就可以使用下面的代码轻松实现莫代尔,阵营 - 全屏模态与引导
import React, {Component} from 'react';
import {BaseComponent} from 'BaseComponent';
import { Modal, Button } from 'react-bootstrap';
class InteractiveMap extends BaseComponent {
constructor(props) {
super(props);
this.open = this.open.bind(this);
this.close = this.close.bind(this);
this.state = {showModal: false};
}
open() {
this.setState({showModal: true});
}
close() {
this.setState({showModal: false});
}
onFormSubmit(values){
const data = {...values};
}
render() {
return(
<div>
<div className="map-menuitem" onClick={this.open}>Interactive Map</div>
<div>
<Modal className="modal-container"
show={this.state.showModal}
onHide={this.close}
animation={true}
dialogClassName="custom-map-modal"
>
<Modal.Header closeButton>
<Modal.Title>Interactive Map</Modal.Title>
</Modal.Header>
<Modal.Body>
The body
</Modal.Body>
<Modal.Footer>
<Button className="button-theme" onClick={this.close}>Close</Button>
<Button className="button-theme button-theme-blue" type="submit">Save changes</Button>
</Modal.Footer>
</Modal>
</div>
</div>
);
}
}
export default InteractiveMap;
在它被写,我可以提供我的自定义的文档css为Modal,所以我做了dialogClassName="custom-map-modal"
其中
.custom-map-modal{
width:100%;
}
以上都不行。
我想在这里实现全屏模态,我该如何实现使用上述方法,或者如果有其他方法可以做,但我只想使用Bootstrap。
必须有一些与你的页面上一些其他的造型。我能够通过添加'width:100%;'来提供全屏模式的示例模式。身高:100%; margin:0'和'height:100%;'转换为'modal-content'。首先查看模态父项并从那里开始工作,直到找到哪个父项阻止宽度全屏。 –
@ChaseDeAnda是的,我可以通过覆盖默认的'模态,模态 - 页脚,模态 - 内容,模态对话框'CSS类来工作,但我最终覆盖了我不想要的其他页面的模态。 – iphonic