mirror of https://github.com/layui/layui
table组件支持自适应父元素高度:#父元素ID-差距值
parent
9230a5e920
commit
ce4dfc3d07
|
@ -347,6 +347,11 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
if(options.height && /^full-\d+$/.test(options.height)){
|
if(options.height && /^full-\d+$/.test(options.height)){
|
||||||
that.fullHeightGap = options.height.split('-')[1];
|
that.fullHeightGap = options.height.split('-')[1];
|
||||||
options.height = _WIN.height() - that.fullHeightGap;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化一些参数
|
//初始化一些参数
|
||||||
|
@ -1479,6 +1484,10 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
height = _WIN.height() - that.fullHeightGap;
|
height = _WIN.height() - that.fullHeightGap;
|
||||||
if(height < 135) height = 135;
|
if(height < 135) height = 135;
|
||||||
that.elem.css('height', height);
|
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;
|
if(!height) return;
|
||||||
|
|
Loading…
Reference in New Issue