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