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

如何移除PrimeNG Carousel组件中的分页功能?

如何移除PrimeNG轮播组件的分页功能?

我来帮你搞定这个问题!要移除PrimeNG轮播的分页功能其实很简单,PrimeNG的Carousel组件本身就提供了现成的属性来控制分页指示器的显示。

你只需要在<p-carousel>标签里添加[showIndicators]="false"这个属性就行——这个属性默认值是true,显式设置为false就能直接隐藏底部的分页按钮了。

修改后的完整代码如下:

<p-carousel *ngIf="estadoClasificacion" 
            [value]="listadoCuentaClasificaciones" 
            [numVisible]="3" 
            [numScroll]="3" 
            [circular]="false"
            [showIndicators]="false"> <!-- 新增这个属性隐藏分页 -->
  <p-header> </p-header>
  <ng-template let-item pTemplate="item">
    <div class="item-details">
      <div class="p-grid p-nogutter">
        <button pButton type="button" 
                label="{{item.descripcion}}" 
                class="ui-button-raised carrusel-botones" 
                (click)="capturaClasificacion(item)"></button>
      </div>
    </div>
  </ng-template>
</p-carousel>

这样修改后,你的轮播组件就不会再显示分页指示器了,其他的轮播功能(比如滚动、内容展示)都能正常运行哦。

内容的提问来源于stack exchange,提问作者Camilo Andres Muñoz Gonzalez

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.06 07:37:39