layui数据表格自定义每页条数limit设置

(编辑:jimmy 日期: 2025/9/18 浏览:2)

废话不多说,直接上代码吧!如下所示:

table.render({
   elem: '#data_grid'
   //,width: 900
   //,height: 274
   ,cols: [[ //标题栏
    {field: 'id', title: 'ID', width: 80, sort: true}
    ,{field: 'username', title:'用户名',width: 100} //空列
    ,{field: 'password', title: '密码', width: 120}
    ,{field: 'gender', title: '性别', width: 150}
    ,{field: 'nichen', title: '昵称', width: 150}
    ,{field: 'birthday', title: '出生年月', width: 120}
    ,{fixed: 'right', width: 215,align:'center', toolbar: '#barDemo'}
   ]]
   ,url:url
   ,skin: 'row' //表格风格
   ,even: true
   ,page: true //是否显示分页
   ,limits: [3,5,10]
   ,limit: 5 //每页默认显示的数量
   ,done:function(res){
    userPage.data = res.data;
   }
   //,loading: false //请求数据时,是否显示loading
  });

主要是:limits 和 limit 的设置

以上这篇layui数据表格自定义每页条数limit设置就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。