[]HTMLDIVElement设置innerHTML时报错

QQ截图20170620174557.png

如图所示。测试代码
Laya.init(Laya.Browser.width, Laya.Browser.height);

var html = new Laya.HTMLDivElement();
html.style.fontSize = 30;
html.style.whiteSpace = "nowrap";
html.innerHTML = '<span style="color:#ffffff">test</span>';
html.pos(500, 300);
html.size(html.contextWidth, html.contextHeight);

Laya.stage.addChild(html);

setTimeout(function() {
html.innerHTML = '';
}, 300);
此问题是由于在新版中改变了laya.html.js的HTMLDivElement中width的set方法
之前的版本中,set方法为
/**
*获取对象的宽
*/
__getset(0,__proto,'width',function(){
if (this._width)return this._width;
return this.contextWidth;
},[b]_super.prototype._$set_width[/b]);
此次出问题的版本为
/**
*获取对象的宽
*/
__getset(0,__proto,'width',function(){
if (this._width)return this._width;
return this.contextWidth;
},[b]function(value){
var changed=false;
changed=value !=this.width;
_super.prototype._$set_width.call(this,value);
if(changed)
[i]this.layout[/i]();
}[/b]);
猜测是this.layout引发的死循环,希望在之后的版本中解决。暂时的解决办法为恢复原先的代码
已邀请:

cuixueying

赞同来自:

已经修复,今天会更新1.7.7beta版本,请关注版本更新,谢谢反馈!

cuixueying

赞同来自:

你是用哪个引擎版本测试的,试下最新版本,我这里测试是正常的,如果已经是最新版本,把你可以运行的例子发下吧!

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作