0

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

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

4

1 回答 1

0

是的,由虚拟滚动组成的组件可能会驻留在手风琴组件内。

在这里查看演示

手风琴.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 代码仍然是相关的。下面的 CSS 使手风琴在虚拟滚动中。

  ngb-accordion {
    height: 400px;
    display: block;
    overflow-y: scroll; }
于 2019-03-29T11:43:49.043 回答