ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
排序:模板列表中,在需要排序的表头加上下面代码,但要注意script的data-params参数里的dataName必须填写列表的唯一的标识值,用于存放列表缓存的名称,同理table里的 data-name="articleCatData" data-tplid="list-tpl"也是必须填写,dataName与data-name的值必须是相同的 ~~~ <div class="order-box"> <a href="javascript:;" class="sort" data-filed="title" data-asc="true"><i class="iconfont" >&#xe615;</i></a> <a href="javascript:;" class="sort down" data-filed="title"><i class="iconfont">&#xe647;</i></a> </div> ~~~ ~~~ <script id="list-tpl" type="text/html" data-params='{"url":"/php/data.php","dataName":"articleCatData","pageid":"#page","tableWidth":"2200px"}'> <table id="example" class="layui-table lay-even" data-name="articleCatData" data-tplid="list-tpl"> <thead> <tr> <th width="30"><input type="checkbox" id="checkall" data-name="checkbox" lay-filter="check" lay-skin="primary"></th> <th width="60">序号</th> <th>标题 <div class="order-box"> <a href="javascript:;" class="sort" data-filed="title" data-asc="true"><i class="iconfont" >&#xe615;</i></a> <a href="javascript:;" class="sort down" data-filed="title"><i class="iconfont">&#xe647;</i></a> </div> </th> <th>连接</th> <th width="70">排序</th> <th width="80">审核</th> <th width="152">操作</th> </tr> </thead> <tbody> {{# layui.each(d.list, function(index, item){ }} <tr> <td><input type="checkbox" name="checkbox" value="{{ item.id}}" lay-skin="primary"></td> <td>{{ item.id}}</td> <td>{{ item.title}}</td> <td>{{ item.url}}</td> <td><input type="text" class="layui-input ajax-blur" name="order" value="{{ item.id}}" data-params='{"url":"/php/test.php","data":"id=1&name=paco","loading":"false"}'> </td> <td><input type="checkbox" name="switch" lay-skin="switch" lay-text="已审|未审" {{#if (item.switch){ }}checked="checked" {{# } }} lay-filter="ajax" data-params='{"url":"/php/test.php","confirm":"true","data":"id={{ item.id}}&name=paco","complete":"test"}'> </td> <td> <button class="layui-btn layui-btn-mini modal-iframe" data-params='{"content": "article-add.html", "title": "{{item.title}}","full":"true"}'> <i class="iconfont">&#xe653;</i>编辑 </button> <button class="layui-btn layui-btn-mini layui-btn-danger ajax" data-params='{"url": "/php/test.php","confirm":"true","data":"id=1&name=ni"}'> <i class="iconfont">&#xe626;</i>删除 </button></td> </td> </tr> {{# }); }} </tbody> </table> </script> ~~~