antd nz-carousel 轮播图图片撑满container 比例不失真。
style=" display: block;"
<ng-template #carouselTpl let-data let-height="height">
<nz-carousel #carousel [style.height]="height" [style.line-height]="height" style="max-width: 100vw;" *ngIf="data!=null&&isCarouselVisible(data)" nzAutoPlay>
<ng-container *ngFor="let item of data;">
<div nz-carousel-content class="d-flex flex-column justify-content-center align-items-center" [style.height]="height" [style.line-height]="height" *ngIf="isAdvertVisible(item)">
<a href="{{getAdvertUrl(item.url)}}" >
<img src="{{getImgUrl(item.img)}}" [style.height]="height" style=" display: block;" />
</a>
</div>
</ng-container>
</nz-carousel>
</ng-template>
height = '40%';
if (this.carouselElement != null) {
//this.renderer.setStyle(this.carouselElement.el, 'height', this.height);
this.renderer.setStyle(this.carouselElement.slickList.nativeElement, 'height', this.height);
// if (this.carouselElement.carouselContents!=null) {
// for (let content of this.carouselElement.carouselContents) {
// this.renderer.setStyle(content.el, 'height', this.height);
// this.renderer.setStyle(content.el, 'height', this.height);
// }
// }
}