如何为表tbody使用cdk-virtual-scroll-viewport

时间:2018-11-04 04:56:28

标签: angular angular7 angular-cdk virtualscroll

因为html会先解析tr然后再解析td, 使用<cdk-virtual-scroll-viewport>会破坏视图,是否有任何cdkVirtualScrollViewport作为<tbody>的指令?

<tbody>
<cdk-virtual-scroll-viewport  style="height: 500px; width: 100%;"  itemSize="100"
    <tr [hidden]="data.get_user.name.toLowerCase().indexOf(pupilFilter.name.toLowerCase()) < 0 || (pupilFilter.classValue != '0' && data.get_class.value != pupilFilter.classValue)" appMarkClicked="" *cdkVirtualFor="let data of top.data.branch.get_users_as_pupil; let i = index" >
        <td>{{i + 1}}</td>
    </tr>
</cdk-virtual-scroll-viewport>
</tbody>

1 个答案:

答案 0 :(得分:3)

好吧,我可以将<cdk-virtual-scroll-viewport放在<table>之前

<cdk-virtual-scroll-viewport>
    <table>
    </table>
</cdk-virtual-scroll-viewport>