前端layui 一列多字段的解决办法

  对layui不熟悉,然后找了个大牛帮吗处理的 留个记录

页面添加如下样式:

<style type="text/css">
.layui-table-cell {
height: auto;
}
</style>

字段渲染代码如下:

cols: [[
{type: 'checkbox'},
{field: 'username', align: 'center', sort: true, title: '账号'},
{field: 'nickName', align: 'center', sort: true, title: '用户名'},
{field: 'phone', align: 'center', sort: true, title: '手机号'},
{field: 'sex', align: 'center', sort: true, title: '性别'},
{field: 'createTime', sort: true, templet: function (d) {
var returnHtml = '';
returnHtml += 'time:' + d.createTime + '<br>';
returnHtml += 'time1:' + d.nickName + '<br>';
returnHtml += 'time2:' + d.username ;
return returnHtml
}, title: '创建时间'
},
{field: 'state', align: 'center', sort: true, templet: '#tplStateTbAdv', title: '状态'},
{align: 'center', toolbar: '#tableBarTbAdv', title: '操作', minWidth: 150}
]]
});

这个align 是控制字段内容位置的

去掉 默认就是左对齐

center是居中,right就是右

猜你喜欢

转载自www.cnblogs.com/pboy/p/12343422.html
今日推荐