小编rei*_*ldk的帖子

使用Aurelia高效渲染大型数据表

使用Aurelia渲染大型数据表时,我正在努力提高性能.

即使在中等大小的表(20x20)的情况下,我的Chrome也不会低于200ms,MS Edge需要大约800ms而IE11大约需要2s.如果要添加(虚拟)滚动,200ms也是一个问题.处理时间随着每个表格单元的绑定数量而增加.我已经整理了一个(例子)绑定'css','class',当然还有单元格内容.

<table class="table">
  <tbody>
    <tr repeat.for="row of rows">
      <td repeat.for="column of columns" css.bind="getCellStyle(column, $parent.$first)" class.bind="getCellClasses(column, row)">
        <template replaceable part="cell-template">
          <span>${getCellText(column, row)}</span>
        </template>
      </td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我有什么想法可以提高性能?

基于初始提议,我试图避免嵌套重复,但在我的情况下这是不可能的,因为列和行都是动态的.

javascript performance aurelia

12
推荐指数
1
解决办法
2166
查看次数

标签 统计

aurelia ×1

javascript ×1

performance ×1