前端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就是右

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM