FairyGUI-layabox icon indicating copy to clipboard operation
FairyGUI-layabox copied to clipboard

[fix]laya2.0+虚拟列表赋值数据执行2次itemRenderer函数

Open krapnikkk opened this issue 5 years ago • 1 comments

laya虚拟列表赋值数据执行2次itemRenderer函数

遇到和论坛的同样问题,研究发现Laya2.0引擎内部升级导致的

Laya 2.0以上对Timer中的callLater的逻辑进行了解耦合,而在Laya 1.7中,是将callater的时钟处理放在Timer中,所以Timer.clear无法清理这个Laya.timer.callLater定时器

源代码【Glist中有两处的Laya.timer.clear是清理_refreshVirtualList不了的】 if (this._virtualListChanged != 0) Laya.timer.clear(this, this._refreshVirtualList); this._refreshVirtualList();

调整为: if (this._virtualListChanged != 0) Laya.CallLater.I._laters.forEach((element, index) => { if (element.method.name == "_refreshVirtualList") { Laya.CallLater.I._laters.splice(index, 1); } }); this._refreshVirtualList();

已向引擎组提相关的issue

krapnikkk avatar Mar 01 '20 16:03 krapnikkk

那其实不用callLater,改成用timer一个很短的时间?

xiaoguzhu avatar Mar 02 '20 07:03 xiaoguzhu