From 8908d68bf302c5e10942e904e7c0da1b9afbbdf9 Mon Sep 17 00:00:00 2001 From: sight <26325820+Sight-wcg@users.noreply.github.com> Date: Sun, 7 Sep 2025 17:36:49 +0800 Subject: [PATCH] update --- src/modules/dropdown.js | 4 ++-- src/modules/table.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 6cb5ccbb..f431755a 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -365,8 +365,8 @@ layui.define(['i18n', 'jquery', 'laytpl', 'lay', 'util'], function(exports) { }); if(resizeObserver){ - resizeObserver.observe(options.elem[0], that.position.bind(that)); - resizeObserver.observe(mainElem[0], that.position.bind(that)); + resizeObserver.observe(options.elem[0], $.proxy(that.position, that)); + resizeObserver.observe(mainElem[0], $.proxy(that.position, that)); } // 组件打开完毕的事件 diff --git a/src/modules/table.js b/src/modules/table.js index dcb277ac..1f657d7b 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -2977,14 +2977,18 @@ layui.define(['lay', 'i18n', 'laytpl', 'laypage', 'form', 'util'], function(expo if(!that.resizeObserver) return; // 显示或隐藏时重置列宽 - that.resizeObserver.observe(that.elem[0], that.resize.bind(that)); + that.resizeObserver.observe(that.elem[0], $.proxy(that.resize, that)); // 同步固定列表格和主表格高度 - that.needSyncFixedColHeight = that.config.syncFixedRowHeight && (that.layBody.length > 1) + var lineStyle = that.config.lineStyle; + var isAutoHeight = lineStyle && (/\bheight\s*:\s*auto\b/g.test(lineStyle) || lineStyle.indexOf('max-height') !== -1); + that.needSyncFixedColHeight = (that.layBody.length > 1) && (that.config.syncFixedRowHeight || (that.config.syncFixedRowHeight !== false && isAutoHeight)); if(that.needSyncFixedColHeight){ - var tableElem = that.layMain.children('table'); - that.resizeObserver.observe(tableElem[0], that.syncFixedColHeight.bind(that)); + that.resizeObserver.observe( + that.layMain.children('table')[0], + $.proxy(that.syncFixedColHeight, that) + ); } };