pull/2503/head
morning-star 2025-02-14 16:47:06 +08:00 committed by GitHub
parent 312ea445a3
commit baf8d77d18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 39 deletions

View File

@ -2823,8 +2823,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
}
rAF(cb);
});
that.autoResize();
}
/**
@ -2893,43 +2891,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
? size.width - size.paddingLeft - size.paddingRight - size.borderLeftWidth - size.borderRightWidth
: size.width
}
}
Class.prototype.autoResize = function(){
var that = this;
if(typeof that.resizeStrategy === 'function'){
that.resizeStrategy(that.elem);
}
}
Class.prototype.resizeStrategy = function(){
// chrome 64+
if(window.ResizeObserver){
return function(targetElem){
var that = this;
if(that.resizeObserver){
that.resizeObserver.disconnect();
that.resizeObserver = null;
}
that.resizeObserver = new ResizeObserver(function(){
that.resize();
});
that.resizeObserver.observe(targetElem[0]);
}
}
// IE8 支持元素 resize 事件
if(lay.ie === '8'){
return function(targetElem){
var that = this;
targetElem.off('resize.lay-table-autoresize')
.on('resize.lay-table-autoresize', function(){
that.resize();
})
}
}
}();
};
// 全局事件
(function(){