[ionic v4自动播放幻灯片会在单击时停止播放

问题描述 投票:0回答:1

我有打开页面时自动播放的离子幻灯片图像

  <ion-grid style="height: 130px;">
    <ion-slides style="
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    
    " [options]="slideOptions" pager="true" #slider (ionSlidesDidLoad)="slidesDidLoad(slider)"> 
      <ion-slide *ngFor="let item of adsArray;let i=index" (click)="gotoAd(i)"  >
        <ion-row>
          <ion-col siz="12">
            <ion-card class="col" style="height: 120px; width: 320px;">
              <img  height="120" width="320" src="https://mysite.co/uploads/{{ item.document }}">
            </ion-card>
          </ion-col>
        </ion-row>
      </ion-slide>
     </ion-slides>
  </ion-grid>

。ts文件

export class Tab1Page implements OnInit {

  dataArray;
  adsArray;

  slideOptions = {
    initialSlide: 1,
    speed: 400,
  };
  slideOptionsads = {
    initialSlide: 1,
    speed: 400,
  };
  constructor(private http: HttpClient,private router: Router,public loadingController: LoadingController) { }

  ionViewDidEnter(slides: IonSlides){
    slides.startAutoplay();
  }

  ionViewWillEnter(slides: IonSlides){
    slides.startAutoplay();
  }

  ionViewDidLoad(slides: IonSlides){
    slides.startAutoplay();
  }

  slidesDidLoad(slides: IonSlides) {
    slides.startAutoplay();
  }

并且当用户单击或手动滑动或打开页面并返回到同一页面时,它将停止自动播放,如何使它始终保持滑动?

javascript html ionic-framework slider ionic4
1个回答
0
投票

即使有问题或您已经有解决方案?,我也遇到同样的情况

© www.soinside.com 2019 - 2024. All rights reserved.