diff --git a/src/modules/table.js b/src/modules/table.js index f82f6ea1..e74bc8b5 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -139,7 +139,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ // thead 区域模板 var TPL_HEADER = function(options){ - var rowCols = '{{#if(item2.colspan){}} colspan="{{=item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{=item2.rowspan}}"{{#}}}'; + var rowCols = '{{#var colspan = layui.type(item2.colspan2) === \'number\' ? item2.colspan2 : item2.colspan; if(colspan){}} colspan="{{=colspan}}"{{#} if(item2.rowspan){}} rowspan="{{=item2.rowspan}}"{{#}}}'; options = options || {}; return ['= 1 || !hide ? 'removeClass' : 'addClass'](HIDE); // 如果子列显示,父列必然需要显示 + parentTh[parentColspan ? 'removeClass' : 'addClass'](HIDE); // 如果子列显示,父列必然需要显示 - getThisCol.colspan = parentColspan; //同步 colspan 参数 - getThisCol.hide = parentColspan >= 1 || !hide; //同步 hide 参数 + getThisCol.colspan2 = parentColspan; // 更新实际的 colspan 数 + getThisCol.hide = parentColspan < 1; // 同步 hide 参数 //递归,继续往上查询是否有父列 var nextParentKey = parentTh.data('parentkey'); @@ -2527,7 +2527,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ if (item22.PARENT_COL_INDEX || (childIndex >= 1 && childIndex == (item2.colspan || 1))) return; item22.PARENT_COL_INDEX = index; item2.CHILD_COLS.push(item22); - childIndex = childIndex + (item22.hide ? 0 : parseInt(item22.colspan > 1 ? item22.colspan : 1)); + childIndex = childIndex + (parseInt(item22.colspan > 1 ? item22.colspan : 1)); eachChildCols(index, cols, i2, item22); } });