1.使用准备
前台需要的资源文件,主要有Bootstrap3相关css、js以及bootstrap Table相关css、js:
<-- 样式 -->
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-table.css">
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="bootstrap-table.js"></script>
<-- 表格汉化js -->
<script src="bootstrap-table-zh-CN.js"></script>
以上这些插件可以到这里下载http://bootstrap-table.wenzhixin.net.cn/zh-cn/getting-started/ (官方文档地址)。
2.使用方法
对于bootstrap table 可以通过data 属性或者javascript 来启用bootstrap table 插件,显示丰富的功能。
这里推荐使用javascript来启用bootstrap table插件来使用bootstrap table,可以实现js和html的分离,代码可以重用,下面我介绍的时候也只介绍这种方法。
3.前端代码
页面代码:
<-- 以下是一些需要的css、js -->
<-- 样式 -->
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-table.css">
<script src="jquery.min.js"></script>
<script src="b