在Bootsrap Modal中填充表列,可以通过以下步骤实现:
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
打开Modal
</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Modal标题</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th>列1</th>
<th>列2</th>
<th>列3</th>
</tr>
</thead>
<tbody>
<tr>
<td>数据1</td>
<td>数据2</td>
<td>数据3</td>
</tr>
<tr>
<td>数据4</td>
<td>数据5</td>
<td>数据6</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存</button>
</div>
</div>
</div>
</div>
<div class="modal-body">
中,并使用Bootstrap的表格样式。这样,当你点击按钮或链接时,Modal将会弹出,并显示填充了表列的内容。
请注意,上述示例中的代码是使用Bootstrap 4版本的语法。如果你使用的是Bootstrap 3版本,部分类名可能会有所不同。
领取专属 10元无门槛券
手把手带您无忧上云