我有一个应用程序,可以创建大量的动态组件(一个网格中多达200个单元)
//get component factory to create components
let factory = this.componentFactoryResolver
.resolveComponentFactory(CellComponent);
//for each cell with data
for (let d of data) {
//create host view with component
let cell = this.grid.createComponent(factory);
//set grid position
cell.instance.column = "_" + d.day;
cell.instance.row = "_" + d.time;
//data entries inside the cell
cell.instance.contents = d.data;
}
我遇到了性能问题,正在检查和更新每个组件的视图。
是否有一种方法可以一次将多个组件插入视图中,或者不检查每个组件?