FairyGUI-layabox
FairyGUI-layabox copied to clipboard
[fix]laya2.0+虚拟列表赋值数据执行2次itemRenderer函数
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
那其实不用callLater,改成用timer一个很短的时间?