Bootstrap为模态框添加滚动条
转载至bootstrap模态框加滚动条的方法, 在html文件的<style>...</style>
标签中加上如下代码即可:
<style type="text/css">
.modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.modal-content {
/*overflow-y: scroll; */
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.modal-body {
overflow-y: scroll;
position: absolute;
top: 55px;
bottom: 65px;
width: 100%;
}
.modal-header .close {margin-right: 15px;}
.modal-footer {
position: absolute;
width: 100%;
bottom: 0;
}
</style>
<body>
...
<button type="button" data-toggle="modal" data-target="#myModal" class="btn btn-primary mr5" style="margin-top:5px">
Finish
</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">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">数据预览</h4>
</div>
<div class="modal-body">
<table id="basicTable" class="table table-striped table-bordered responsive">
<thead class="">
<tr>
<th v-for="(head,index) in analysis_columns" v-text="head"></th>
</tr>
</thead>
<tbody>
<tr v-for="(row,index_i) in analysis_values">
<td v-for="(column,index_j) in row" v-text="column"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-default" data-dismiss="modal">重置</button>
<button type="submit" class="btn btn-primary" v-on:click="submitForm()">提交</button>
</div>
</div>
</div>
</div>
</body>