layUi数据表格自动渲染

https://www.layui.com/doc/modules/table.html#autoRender

<table class="layui-table" lay-data="{height:315, url:'/demo/table/user/', page:true, id:'test'}" lay-filter="test">
  <thead>
    <tr>
      <th lay-data="{field:'id', width:80, sort: true}">IDth>
      <th lay-data="{field:'username', width:80}">用户名th>
      <th lay-data="{field:'sex', width:80, sort: true}">性别th>
      <th lay-data="{field:'city'}">城市th>
      <th lay-data="{field:'sign'}">签名th>
      <th lay-data="{field:'experience', sort: true}">积分th>
      <th lay-data="{field:'score', sort: true}">评分th>
      <th lay-data="{field:'classify'}">职业th>
      <th lay-data="{field:'wealth', sort: true}">财富th>
    tr>
  thead>
table>
    

自动渲染,直接在表格中配置好参数信息,无需再去写js,也可直接在此处开启分页 layui默认有分页设置,只需在lay-data的参数中写 page:true即可开启分页。

转载于:https://www.cnblogs.com/lxk233/p/9860969.html

你可能感兴趣的:(javascript,网络)