docs: 更新 table 文档

fix/fixed-table-rowHeight-sync
sight 2025-09-12 23:58:58 +08:00
parent 725f6e849c
commit ef2c7665ec
2 changed files with 11 additions and 1 deletions

View File

@ -254,6 +254,16 @@ height: function(){
</td> </td>
<td>string</td> <td>string</td>
<td>-</td>
</tr>
<tr>
<td>syncFixedRowHeight <sup>2.12+ 实验性</sup></td>
<td>
是否强制计算表格主区域的行高度并同步到固定列区域。开启后会对表格性能有一定的影响,仅适用于行高度自适应的场景。
</td>
<td>boolean</td>
<td>-</td> <td>-</td>
</tr> </tr>
<tr> <tr>

View File

@ -2993,7 +2993,7 @@ layui.define(['lay', 'i18n', 'laytpl', 'laypage', 'form', 'util'], function(expo
// 同步固定列表格和主表格高度 // 同步固定列表格和主表格高度
var lineStyle = that.config.lineStyle; var lineStyle = that.config.lineStyle;
var isAutoHeight = lineStyle && (/\bheight\s*:\s*auto\b/g.test(lineStyle) || lineStyle.indexOf('max-height') !== -1); var isAutoHeight = lineStyle && /\bheight\s*:\s*auto\b/g.test(lineStyle);
// 只重载数据时需要主动同步高度,因为 tbody 大小可能不变 // 只重载数据时需要主动同步高度,因为 tbody 大小可能不变
var needSyncFixedColHeight = that.needSyncFixedColHeight = (that.layBody.length > 1) && (that.config.syncFixedRowHeight || (that.config.syncFixedRowHeight !== false && isAutoHeight)); var needSyncFixedColHeight = that.needSyncFixedColHeight = (that.layBody.length > 1) && (that.config.syncFixedRowHeight || (that.config.syncFixedRowHeight !== false && isAutoHeight));