如下所示:
table.render({
elem: '#LAY_table_user'
,url:"<%=path%>/mybill/findBill.do"
,cols: [[
{field:'type', title: ' ', sort: true,align :'center'}
,{field:'mailno', title: ' ',align :'center'}
,{field:'sex', title: ' ', sort: true,align :'center'}
,{field:'playmoney',title: ' ',align :'center'}
,{field:'sign', title: ' ',align :'center'}
,{field:'smomey', title: ' ', sort: true,align :'center'}
,{field: 'createTime', title: ' ',
templet :function (row){
return createTime(row.createTime);
}
}
]]
,id: 'testReload'
,page: true
});
方式二:函数转义。自 layui 2.2.5 开始,templet 开始支持函数形式,函数返回一个参数 d,包含接口返回的所有字段和数据。如下所示:
table.render({
cols: [[
{field:'title', title: '文章标题', width: 200
,templet: function(d){
return 'ID:'+ d.id +',标题:'+ d.title +''
}
}
,{field:'id', title:'ID', width:100}
]]
});
可以好好看看layui table模块
效果图
以上这篇layui实现把数据表格时间戳转换为时间格式的例子 就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



