Object doesn't support this property or method
在IE8中收到以下错误:“ ”region.getWorld();
allWidth: function() {
var me = this,
states = me.getstates(),
waterY = 0,
placeY = 0,
World;
states.forEach(function(region) {
World = region.getWorld();
if (World.y < placeY) {
placeY = World.y;
}
if (World.y + World.height > waterY) {
waterY = World.y + World.height;
}
});
return waterY - placeY;
},
IE8不支持forEach
Arrays方法。您可以通过几种方法来解决此问题。
您可以使用普通的for循环:
for(var i = 0; i < states.length; i++){
var region = states[i];
/* ... */
由于您使用的是extjs,因此您也可以使用Ext.each
方法:
Ext.each(states, function(region){
...
或者,您可以使用填充程序/ polyfillforEach
在IE8中添加该方法。
你可以找到在A填充工具forEach
上MDN方法在这里。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句