前端界面
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#test'
, url: '/role/list'
, cols: [
[
{type: 'checkbox',fixed: 'left'}
, {field: 'rId', width: 80, title: 'ID', sort: true}
, {field: 'rName', width: 80, title: '用户名'}
, {field: 'rState', width: 80, title: '性别', sort: true}
, {field: 'rAuto', width: 80, title: '城市'}
, {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150}
]
]
, page: true
});
});
增加page字段即可,
,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
//,curr: 5 //设定初始在第 5 页
,groups: 1 //只显示 1 个连续页码
,first: false //不显示首页
,last: false //不显示尾页