From ef59dde665984bcccda92c44d0d15e5648deb9fd Mon Sep 17 00:00:00 2001 From: sunxb <470459819@qq.com> Date: Wed, 21 Sep 2022 15:35:15 +0800 Subject: [PATCH] =?UTF-8?q?table=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E7=BA=A7?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E5=90=88=E5=B9=B6=E8=A1=A8=E5=A4=B4=E7=9A=84?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index e8879544..dfcdb3f2 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -677,9 +677,10 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ var groups = that.layHeader.find(( // 根据当前活动的表头 parentkey 属性查找其组合表头 th ? ('th[data-key='+ th.data('parentkey') +']>') : '' - ) + '.' + ELEM_GROUP).get().reverse(); // 若无指向当前活动表头,则自下而上获取所有组合表头 + ) + '.' + ELEM_GROUP); // 若无指向当前活动表头,则自下而上获取所有组合表头 - layui.each(groups, function(){ + groups.css('width', 0); + layui.each(groups.get().reverse(), function(){ var othis = $(this); var key = othis.parent().data('key'); var maxWidth = 0; @@ -698,6 +699,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ that.setGroupWidth(othis.parent()); } }); + groups.css('width', 'auto'); }; // 动态分配列宽