layui talbe内容自动换行以及固定列自适应换行后的高度

CSS样式(必须)

.layui-table-cell {
	line-height: 20px !important;
	vertical-align: middle;
	height: auto;
	overflow: visible;
	text-overflow: inherit;
	white-space: normal;
}

固定列自适应换行后的高度

that.tableIns = that.http.table({
	id: 'dmmoDataList'
	, elem: '#dmmoDataList'
	, height: '300px'
	, data: data
	, page: {curr: 1}//重新从第 1 页开始
	, skin: 'rows'
	, cols: [[ //表头
		{field: '', type: 'numbers', title: '序号', fixed: 'left', align: 'center'}
		]]
	, done: function (res) {
		that.$(".layui-table-main tr").each(function (index, val) {
			that.$(that.$(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height(that.$(val).height());
			that.$(that.$(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height(that.$(val).height());
		});
	}
});

你可能感兴趣的:(layui,前端,javascript)