我们如何在nz旋转木马中使用goTo(slidenumber)?如果我想直接看具体的幻灯片编号



请查找ng-zorro链接以供参考。https://ng.ant.design/components/carousel/en#header

使用ViewChild获取组件实例并使用实例方法。

index = 0;
@ViewChild(NzCarouselComponent, { static: false }) myCarousel: NzCarouselComponent;
goTo() {
this.myCarousel.goTo(Number(this.index));
}

https://stackblitz.com/edit/angular-6rsuzz?file=src/app/app.component.ts

相关内容

最新更新