From 588a2f69b878488396752959f2f50e72f2a5df27 Mon Sep 17 00:00:00 2001 From: sight <26325820+Sight-wcg@users.noreply.github.com> Date: Sat, 6 Sep 2025 00:06:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(table):=20=E6=96=B0=E5=A2=9E=20syncFixedRo?= =?UTF-8?q?wHeight=20=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 44f780d0..82e53001 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -2962,20 +2962,16 @@ layui.define(['lay', 'i18n', 'laytpl', 'laypage', 'form', 'util'], function(expo if(!that.resizeObserver) return; // 显示或隐藏时重置列宽 - that.resizeObserver.observe(that.elem[0], function(){ - that.resize(); - }); + that.resizeObserver.observe(that.elem[0], that.resize.bind(that)); // 同步固定列表格和主表格高度 - that.needSyncFixedColHeight = (that.layBody.length > 1) && - that.config.lineStyle && - (/\bheight\s*:\s*auto\b/g.test(that.config.lineStyle) || that.config.lineStyle.indexOf('max-height') !== -1); + that.needSyncFixedColHeight = that.config.syncFixedRowHeight && + (that.layBody.length > 1) && + that.config.lineStyle if(that.needSyncFixedColHeight){ var tableElem = that.layMain.children('table'); - that.resizeObserver.observe(tableElem[0], function () { - that.syncFixedColHeight(); - }); + that.resizeObserver.observe(tableElem[0], that.syncFixedColHeight.bind(that)); } };