layui怎么那么难用,文档上分页是true就行,什么也不用管。怎么我不行啊。百度一下,一个比一个麻烦,还是从中间讲的,摸不到头脑
你说的分页是表格加分页,还是单独使用 参考一下这个 https://www.layui.com/demo/ 或者把你代码贴出来
截图贴出来
就是最基础的啊。直接抄例子
<?php
header('Access-Control-Allow-Origin: *');
$arr = ['code' => 0,
'msg'=> "",
'count'=> 1000,
'data' => [
['id' => 1, 'username' => '小明', 'sex' => '男', 'city' => '北京'],
['id' => 2, 'username' => '小红', 'sex' => '女', 'city' => '北京']
]
];
print json_encode($arr);//返回json数据,接口
?>
layui.use('table', function(){
var table = layui.table;
//第一个实例
table.render({
elem: '#demo'
,height: 312
,url: 'http://192.168.3.7/test.php' //数据接口
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true}
,{field: 'username', title: '用户名', width:80}
,{field: 'sex', title: '性别', width:80, sort: true}
,{field: 'city', title: '城市', width:80}
]]
,page:true
});
});