表格列过多且无数据时,增加底部滚动条,以便查看所有的列

pull/1110/head
jary 2022-08-11 15:28:38 +08:00
parent 9230a5e920
commit b71740f4c1
1 changed files with 8 additions and 1 deletions

View File

@ -791,6 +791,13 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
that.setGroupWidth();
// 如果表格内容为空(无数据 或 请求异常)
if (that.layMain.find('tbody').is(":empty")) {
// 将表格宽度设置为跟表头一样的宽度,使之可以出现底部滚动条,以便滚动查看所有字段
const headerWidth = that.layHeader.first().children('table').width()
that.layMain.find('table').width(headerWidth);
}
that.loading(!0);
};