示例代码,有问题留言,我做详细解释,谢谢各位。
<table class="layui-hide" lay-filter="test"></table>
<script type="text/html" >
{{# if(d.is_hide === 1){ }}
{{}}
{{# } }}
{{# if(d.is_hide === 2){ }}
****
{{# } }}
</script>
<script type="text/html" >
{{# if(d.msg_reply === null){ }}
<i class="layui-icon"></i> 暂未回复
{{# } }}
{{# if(d.msg_reply != null){ }}
{{d.msg_reply}}
{{# } }}
</script>
<script>
('table', function(){
var table =
, form = ;
//第一个实例
({
elem: '#demo'
//,height: 312
,url: "{:url('index/msg/index')}" //数据接口
,page: true //开启分页
,response: {
statusCode: 200 //成功的状态码,默认:0
}
, size: 'lg' //sm小尺寸的表格 lg大尺寸
, cellMinWidth: 150
, limits: [5, 10, 15, 20, 25, 30]
, limit: "{:config('pages')}"
,toolbar: '#toolbarDemo'
,defaultToolbar: ['filter', 'exports'] //工具类
, loading: true
, id: 'test'
,cols: [[ //表头
{field: 'id', title: 'ID', width:60, sort: true, fixed: 'left'}
,{field: 'username', title: '用户名',templet:"#username",width:80}
,{field: 'msg_con', title: '问题',}
,{field: 'msg_reply', title: '回复',templet:"#reply"}
,{field: 'create_time', title: '发布时间', sort: true}
,{field: 'update_time', title: '回复时间', sort: true}
]]
});
//监听搜索
('submit(LAY-search)', function (data) {
//执行重载
('test', {
page: {
curr: 1 //重新从第 1 页开始
}
,where:
});
});
});
</script>