fix(table): 修复 table 在 IE8 下报错问题 (#2437)

* fix(table): 修复 table 在 IE8 下报错问题

* update code
This commit is contained in:
morning-star 2024-12-30 13:50:34 +08:00 committed by GitHub
parent b0b387a0fe
commit 0d17679d01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -254,9 +254,12 @@
};
// 获取节点的 style 属性值
// currentStyle.getAttribute 参数为 camelCase 形式的字符串
Layui.prototype.getStyle = function(node, name){
var style = node.currentStyle ? node.currentStyle : win.getComputedStyle(node, null);
return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
return style.getPropertyValue
? style.getPropertyValue(name)
: style.getAttribute(name.replace(/-(\w)/g, function(_, c){ return c ? c.toUpperCase() : '';}));
};
// css 外部加载器

View File

@ -2898,7 +2898,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
Class.prototype.autoResize = function(){
var that = this;
that.resizeStrategy(that.elem);
if(typeof that.resizeStrategy === 'function'){
that.resizeStrategy(that.elem);
}
}
Class.prototype.resizeStrategy = function(){