在React中使用Bootstrap框架
组件Render
<button className='btn btn-primary btn-sm' onClick={() => openModal()}>详细</button>
<div className="modal fade" id="info-modal" tabIndex={-1} aria-labelledby="" aria-hidden="true">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<h1 className="modal-title fs-5" id="exampleModalLabel">通知详细</h1>
</div>
<div className="modal-body">
...
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
用于控制模态框的Js/Ts函数
const openModal = () => {
const modal = new Modal('#info-modal');
modal?.show();
}
标签:modal,Bootstrap,Js,React,Modal,使用
From: https://www.cnblogs.com/Tachibana-Yuki/p/17984555