You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular15中ngx-infinite-scroll与mat-select结合时滚动事件未触发问题

Angular 15 + Legacy Angular Material 下 ngx-infinite-scroll 与 mat-select 集成问题

我在用Angular v15和Legacy Angular Material,想实现ngx-infinite-scroll和mat-select/mat-option的配合使用。之前用的ng-mat-select-infinite-scroll适配不了Legacy版本的Material,所以换成了ngx-infinite-scroll。但配置完HTML代码后,scrollDown()方法完全没被触发,还出现了两个滚动条,明显是配置有问题。

相关代码

<mat-select panelClass="lazyloadselector" 
            [formControl]="appselect" 
            [complete]="offset === tempOptions.length"
            (openedChange)="openChanged($event)" 
            [disabled]="disabled" 
            (selectionChange)="selectionChangedTrigger($event)">
  <mat-option unselectable="on" 
              [disabled]="true">
      <input  type="text" 
              (keyup)="onKeyUp($event)"
              placeholder="Search..." 
              #input 
              (keydown.space)="$event.stopPropagation()">
  </mat-option>
  <div class="search-results" 
       infiniteScroll 
       infinite-scroll 
       [infiniteScrollDistance]="2"
       [infiniteScrollThrottle]="150" 
       (scrolled)="scrollDown()">
     <mat-option *ngFor="let option of tempInfiniteScrollOptions" 
                 [value]="option.value">{{option.viewValue}}
    </mat-option>
  </div>
</mat-select>

异常滚动条截图

滚动条异常截图

内容的提问来源于stack exchange,提问作者Nelleke Rietvink

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 05:12:58