MOBILE-3947 core: Fix swipe-slides component
parent
130810ca3e
commit
890dbb0245
|
@ -1,5 +1,4 @@
|
|||
<swiper-container #swiperRef *ngIf="loaded" (slidechangetransitionstart)="slideWillChange()" (slidechangetransitionend)="slideDidChange()"
|
||||
[initialSlide]="options.initialSlide" [runCallbacksOnInit]="options.runCallbacksOnInit">
|
||||
<swiper-container #swiperRef *ngIf="loaded">
|
||||
<swiper-slide *ngFor="let item of items; index as index" [attr.aria-hidden]="!isActive(index)">
|
||||
<ng-container *ngIf="template" [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{item: item, active: isActive(index)}" />
|
||||
</swiper-slide>
|
||||
|
|
|
@ -50,6 +50,13 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
|
|||
if (swiperRef?.nativeElement?.swiper) {
|
||||
this.swiper = swiperRef.nativeElement.swiper as Swiper;
|
||||
|
||||
if (this.options.initialSlide) {
|
||||
this.swiper.slideTo(this.options.initialSlide, 0, this.options.runCallbacksOnInit);
|
||||
}
|
||||
|
||||
this.swiper.on('slideChangeTransitionStart', () => this.slideWillChange());
|
||||
this.swiper.on('slideChangeTransitionEnd', () => this.slideDidChange());
|
||||
|
||||
Object.keys(this.options).forEach((key) => {
|
||||
if (this.swiper) {
|
||||
this.swiper.params[key] = this.options[key];
|
||||
|
|
Loading…
Reference in New Issue