在PrimeNg文档中说我可以通过属性'showNavigators'隐藏导航按钮,但是当我绑定在carousel中时什么都没有发生。
<p-carousel [value]="product.imageUrls" [showNavigators]="false" [style]="{'min-height':'300px', 'max-height':'300px'}">
<ng-template let-image pTemplate="item">
<img [src]="image">
</ng-template>
</p-carousel>
我做错了什么,或者可能有另一种方式隐藏导航按钮?
这可能是因为您的代码中有较旧的PrimeNG版本,但您正在查看当前的文档。
你可以用CSS:
隐藏它们:host ::ng-deep p-carousel {
//On later realease of PrimeNG, this can be done programmatically with [showIndicators | showNavigators]="false"
.p-carousel-indicators {
display: none !important;
}
.p-carousel-next, .p-carousel-prev {
display: none !important;
}
}
[showNavigators]="false">