From ce4dfc3d07edac34da61c2a6b66b3f8e5d7cb511 Mon Sep 17 00:00:00 2001 From: YONG PENG Date: Thu, 11 Aug 2022 18:46:32 +0800 Subject: [PATCH] =?UTF-8?q?table=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E7=88=B6=E5=85=83=E7=B4=A0=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=EF=BC=9A#=E7=88=B6=E5=85=83=E7=B4=A0ID-=E5=B7=AE?= =?UTF-8?q?=E8=B7=9D=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/table.js b/src/modules/table.js index 25cd0f60..b2be5ea1 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -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; } //初始化一些参数 @@ -1479,6 +1484,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;