JSFiddle - React, Tailwind, and code Playground
by wenyi
HTML
<!-- 表格主体-->
<table id="table" class="table table-hover table-bordered table-striped">
</table>
JavaScript
$(function () {
view.init_table();
});
var view = {
table: null,//表格对象
dataUrl: "{:url('/sys/role/index')}",//数据加载地址
addUrl: "{:url('/sys/role/add')}",//数据添加地址
editUrl: "{:url('/sys/role/edit')}",//菜单编辑地址
delUrl: "{:url('/sys/role/delete')}",//删除数据地址
roleUrl: "{:url('/sys/role/roleSetting')}",//权限设置地址
selectedData: null,//选中的数据,
id: 0,//操作数据的主键
defaultColumns: function () {
//表头数据列
return [
{checkbox: true},
{field: 'name', title: '名称', align: 'center', sortable: true},
{field: 'code', title: '代码', align: 'center', sortable: true},
{field: 'represent', title: '描述', align: 'center', sortable: false},
{
field: 'create_time', title: '创建时间', align: 'center', sortable: true
},
{
field: 'update_time', title: '修改时间', align: 'center', sortable: true
},
{
field: 'delete_time', title: '是否已删除', align: 'center', formatter: function (arg) {
if (arg == null) {
return '否';
}
return '是,删除时间:' + arg;
}, visible: false
}
];
},
init_table: function () {
//初始化表格
var that = this;
this.table = $('#table').bootstrapTable({
...