是否可以在ngbaccordion中使用cdk虚拟滚动

问题描述 投票:0回答:1

需要知道是否可以在特定的手风琴如ng-bootstrap中使用这个新功能@ angular / cdk / scrolling(在mat-accordion中它是https://stackblitz.com/edit/virtual-scroll-expansion-panels?file=app%2Fapp.component.ts

https://stackblitz.com/edit/angular-ahzm1v?file=app%2Faccordion-basic.ts

accordion ng-bootstrap angular-cdk-virtual-scroll
1个回答
0
投票

是的,可能由虚拟滚动组成的组件将驻留在accordion组件内。

检查demo here

accordion.component.html:

<ngb-accordion #acc="ngbAccordion" >
    <ngb-panel [title]="num" *ngFor="let num of numbers">
        <ng-template ngbPanelContent>
            Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute,
            non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua
            put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore
            wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
            <cdk-virtual-scroll> Loading..... </cdk-virtual-scroll>
            occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore
            sustainable VHS.
        </ng-template>
    </ngb-panel>
</ngb-accordion>

编辑:stackblitz code above仍然相关。以下CLASS使手风琴进入虚拟滚动。

  ngb-accordion {
    height: 400px;
    display: block;
    overflow-y: scroll; }
© www.soinside.com 2019 - 2024. All rights reserved.