Browse Source

fix(table): 改进表格自动调整大小的处理 (#2284)

* fix(table): 修复表格列宽计算一些边缘情况

* fix(table): 改进自动调整大小的处理
pull/2318/head
morning-star 2 weeks ago committed by GitHub
parent
commit
7869687e81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      src/modules/table.js

9
src/modules/table.js

@ -501,7 +501,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
try {
isNone = parent.css('display') === 'none';
} catch(e){}
if(parent[0] && !lay.isTopElem(parent[0]) && (!width || isNone)) return getWidth(parent.parent());
var parentElem = parent.parent();
if(parent[0] && parentElem && parentElem.nodeType === 1 && (!width || isNone)) return getWidth(parentElem);
return width;
};
return getWidth();
@ -1060,7 +1061,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
Class.prototype.resize = function(){
var that = this;
if (!that.layMain) return;
var tableElemIsConnected = that.layMain && ('isConnected' in that.layMain[0]
? that.layMain[0].isConnected
: $.contains(document.body, that.layMain[0]));
if(!tableElemIsConnected) return;
that.fullSize(); // 让表格铺满
that.setColsWidth(); // 自适应列宽

Loading…
Cancel
Save