yii2.0 模态框简单使用

 1 <?php foreach($data as $model) :?>
 2 
 3   <!-- 按钮触发模态框 -->
 4   <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal<?=$model->id;?>">
 5 
 6     点击按钮显示模态框
 7   </button>
 8   <!-- 模态框(Modal) -->
 9   <div class="modal fade" id="myModal<?=$model->id;?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
10     <div class="modal-dialog" style="width:600px"><!-- 设置宽度-->
11       <div class="modal-content">
12         <div class="modal-header">
13           <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> x </button>
14           <h4 class="modal-title" id="myModalLabel"> 预览 </h4>
15         </div>
16         <div class="modal-body">
17           在这里添加一些文本
18         </div>
19         <div class="modal-footer">
20           <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
21         </div>
22       </div><!-- /.modal-content -->
23     </div><!-- /.modal -->
24   </div>
25 
26 <?php  endforeach;?>

 

posted @ 2017-08-11 15:19  py卡卡  阅读(335)  评论(0编辑  收藏  举报