Merge branch 'layui:main' into main

pull/1128/head
sunxiaobin89 2022-08-18 21:50:26 +08:00 committed by GitHub
commit 9fa18cc941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -840,7 +840,6 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table-hover,
.layui-table-click{background-color: #FAFAFA;}
.layui-table[lay-even] tr:nth-child(even){background-color: #f2f2f2;}
.layui-table th,
.layui-table td,
@ -937,6 +936,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table-body{position: relative; overflow: auto; margin-right: -1px; margin-bottom: -1px;}
.layui-table-body .layui-none{line-height: 26px; padding: 30px 15px; text-align: center; color: #999;}
.layui-table-body .layui-table[lay-even] tr:nth-child(even){background-color: #f2f2f2;}
.layui-table-fixed{position: absolute; left: 0; top: 0; z-index: 101;}
.layui-table-fixed .layui-table-body{overflow: hidden;}
.layui-table-fixed-l{box-shadow: 1px 0 8px rgba(0,0,0,.08);}

View File

@ -347,6 +347,11 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
if(options.height && /^full-\d+$/.test(options.height)){
that.fullHeightGap = options.height.split('-')[1];
options.height = _WIN.height() - that.fullHeightGap;
} else if (options.height && /^#\w+-{1}\d+$/.test(options.height)) {
var parentDiv = options.height.split("-");
that.parentHeightGap = parentDiv.pop();
that.parentDiv = parentDiv.join("-");
options.height = $(that.parentDiv).height() - that.parentHeightGap;
}
//初始化一些参数
@ -790,7 +795,14 @@ 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);
};
@ -1479,6 +1491,10 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
height = _WIN.height() - that.fullHeightGap;
if(height < 135) height = 135;
that.elem.css('height', height);
} else if (that.parentDiv && that.parentHeightGap) {
height = $(that.parentDiv).height() - that.parentHeightGap;
if (height < 135) height = 135;
that.elem.css("height", height);
}
if(!height) return;