page.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <title>开启分页 - 数据表格</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>组件</cite></a>
  6. <a><cite>数据表格</cite></a>
  7. <a><cite>开启分页</cite></a>
  8. </div>
  9. </div>
  10. <div class="layui-fluid">
  11. <div class="layui-row layui-col-space15">
  12. <div class="layui-col-md12">
  13. <div class="layui-card">
  14. <div class="layui-card-header">开启分页</div>
  15. <div class="layui-card-body">
  16. <table class="layui-hide" id="test-table-page"></table>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <script>
  23. layui.use(['admin', 'table'], function(){
  24. var admin = layui.admin
  25. ,table = layui.table;
  26. table.render({
  27. elem: '#test-table-page'
  28. ,url: './json/table/user.js'
  29. ,cols: [[
  30. {field:'id', width:80, title: 'ID', sort: true}
  31. ,{field:'username', width:80, title: '用户名'}
  32. ,{field:'sex', width:80, title: '性别', sort: true}
  33. ,{field:'city', width:80, title: '城市'}
  34. ,{field:'sign', title: '签名', minWidth: 150}
  35. ,{field:'experience', width:80, title: '积分', sort: true}
  36. ,{field:'score', width:80, title: '评分', sort: true}
  37. ,{field:'classify', width:80, title: '职业'}
  38. ,{field:'wealth', width:135, title: '财富', sort: true}
  39. ]]
  40. ,page: true
  41. });
  42. admin.popup({
  43. content: '演示数据均为静态模拟数据,因此【切换分页和条数时】发现数据未变并非 BUG。实际使用时改成真实接口即可。'
  44. ,area: '300px'
  45. ,offset: '15px'
  46. ,shade: false
  47. });
  48. });
  49. </script>