4

I updated my Ionic 3 project to Ionic 4 and since then my slider first loads slide with index 0 and after some seconds it loads the initial slide. Is there a solution for this problem?

This is my HTML


    <ion-slides [options]="slideOpts" (ionSlideDidChange)="slideDidChange()" #myslides style="height:100%; width:100%;">
        <ion-slide>
            <app-noticed-events style="height:100%; width:100%;"></app-noticed-events>
        </ion-slide>
        <ion-slide>
            <app-home style="height:100%; width:100%;"></app-home>
        </ion-slide>
        <ion-slide>
          <app-map style="height:100%; width:100%;"></app-map>
        </ion-slide>
      </ion-slides>

This is my TS-Code

slideOpts = {initialSlide:1, zoom: false}

Could lazyloading be the problem?

4

1 回答 1

0

你试过这样设置吗?

.html

 <ion-slides pager="true" [options]="slideOpts">
      <ion-slide>
        <h1>Slide 1</h1>
      </ion-slide>
      <ion-slide>
        <h1>Slide 2</h1>
      </ion-slide>
      <ion-slide>
        <h1>Slide 3</h1>
      </ion-slide>
    </ion-slides>

.ts

 slideOpts = {
    initialSlide: 2
  };

所有选项都在这里http://idangero.us/swiper/api/

于 2019-05-10T18:06:24.613 回答