mirror of
https://gitee.com/layui/layui.git
synced 2025-04-05 17:38:02 +08:00
parent
312ea445a3
commit
baf8d77d18
@ -2823,8 +2823,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
}
|
}
|
||||||
rAF(cb);
|
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 - size.paddingLeft - size.paddingRight - size.borderLeftWidth - size.borderRightWidth
|
||||||
: size.width
|
: 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(){
|
(function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user