【发布时间】:2022-03-06 00:40:27
【问题描述】:
我想显示react-bootstrap-modal,但只有覆盖出现并且模态不显示
import Modal from 'react-bootstrap-modal';
......
<Modal
show={this.state.open}
onHide={this.closeModal}
aria-labelledby="ModalHeader"
>
<Modal.Header closeButton>
<Modal.Title id='ModalHeader'>A Title Goes here</Modal.Title>
</Modal.Header>
<Modal.Body>
<p>Some Content here</p>
</Modal.Body>
<Modal.Footer>
// If you don't have anything fancy to do you can use
// the convenient `Dismiss` component, it will
// trigger `onHide` when clicked
<Modal.Dismiss className='btn btn-default'>Cancel</Modal.Dismiss>
// Or you can create your own dismiss buttons
<button className='btn btn-primary'>
Save
</button>
</Modal.Footer>
</Modal>
.....
截图:
【问题讨论】:
-
谢谢!当我将现有的 bootstrap 3 + react-bootstrap 应用程序更新到 bootstrap 4 时,我花了几个小时试图解决这个问题。结果证明这是解决方案。 (而且这个未解决且显然长期存在的问题确实让我对 react-bootstrap 感到厌烦。我不会在任何新应用程序上使用它。)