layui单元格换行

layui单元格换行 使其能显示,如果左右列固定,在done回调中使用下方方法

 .layui-table-cell {
            height: auto;
        }
//固定行随单元格自动调整
function autoFixedHeight(tableElem) {
    // 获取表格div
    var $tableView = $(tableElem).next(".layui-table-view");
    // 获取两侧浮动栏
    var $fixed = $tableView.find(".layui-table-fixed");
    var dataIndex;
    var trHeight;
    // 遍历tr 修正浮动栏行高
    $tableView.find(".layui-table-main").find("tr").each(function () {
        dataIndex = $(this).attr("data-index");
        trHeight = $(this).css("height");
        $fixed.find("tr[data-index=" + dataIndex + "]").css("height", trHeight);
    });
}
//使用
//layui.....
done:function(){
autoFixedHeight(this.elem[0])
}
作者: JaminYe
版权声明:本文原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文地址:https://www.cnblogs.com/JaminYe/p/13388023.html