ng-alain中的表格未指定表格宽度模式,并且表格自定义渲染中使用 ellipsis,导致出现Maximum call stack size exceeded 报错

ng-alain 表格中定义的表格宽度模式是这样的,并且使用了自定义渲染组件program-preview

<st [widthMode]="{ type: 'strict' }" >
<ng-template st-row="customContent" let-programContent let-index="programContent">
<program-preview *ngIf="programContent.program_id" [program]="programContent"
                  [title]="programContent['program_content']" [odp_width]="userSrv.userInfo.odp_width"
                  [odp_height]="userSrv.userInfo.odp_height" [ellipsis_length]="10">
                </program-preview>
  </ng-template>
</st>

然后自定义组件中是这样的:

<ellipsis [length]="ellipsis_length">{{ title }}</ellipsis>

在表格数据达到 300 多的时候,并且表格不分页,会导出页面发生如下错误
rangeError.png

解决方案

<st [widthMode]="{ type: 'strict', strictBehavior: 'wrap'  }" ></st>

可能原因

如果表格不指定 strict 的行为模式 strictBehavior: 'wrap',这个模式的默认方式是 truncate,也会去把字符串做省略处理,导出发生循环判断问题。


刘大山笔记
3 声望0 粉丝