代码:
//序号
{title:'序号',width:60,templet:function (res) {
return res.LAY_INDEX
}}
<script type="text/html" id="indexTpl">
{{d.LAY_TABLE_INDEX+1}}
</script>
//时间戳转正常时间
, {field:'goods_create_time',title:'创建时间',width:120,templet:'<div>{{ getLocalTime(d.goods_create_time) }}</div>'}
<script>
function getLocalTime(time) {
var d =new Date(time *1000);
var year =d.getFullYear(),month =d.getMonth()+1,date =d.getDate(),
hour =d.getHours(),minute =d.getMinutes(),second =d.getSeconds();
return year+'-'+month+'-'+date+' '+hour+':'+minute+':'+second;
}
layui.use('table');
</script>
网友评论