简体   繁体   English

ionic3 ion-slide在尝试第二次时不会转到下一张幻灯片

[英]ionic3 ion-slide doesn't go to next slide when trying second time

I have ion-slides in a modal that works fine: 我的离子滑模工作正常:

First I lock the slides until the user answers the question; 首先,我锁定幻灯片,直到用户回答问题为止。 then click on next button to unlock the swipe to go to the next slide (question) etc... 然后单击下一步按钮以解锁滑动以转到下一张幻灯片(问题)等...

This works fine, but when I close the modal when I'm still in the first slide or any slide, and back again open the modal, the first slide appears normally but when the user clicks next the next slide doesn't appear until I resize the window or make landscape orientation or move from phone window to normal browser window. 效果很好,但是当我仍在第一张幻灯片或任何幻灯片中时关闭模态,然后再次打开模态时,第一张幻灯片正常显示,但是当用户单击下一张幻灯片时,直到我单击时,下一张幻灯片才会出现调整窗口大小或横向放置或从手机窗口移至普通浏览器窗口。

Any one know what the problem is? 有人知道是什么问题吗?

ionic cli : 4.0.2 离子cli:4.0.2

ionic-angular: 3.9.2 离子角:3.9.2

angular-core: 5.0.0 角芯:5.0.0

Some of the code: maybe will help : 一些代码:也许会有所帮助:

ngAfterViewInit() {
  this.assessSlides.autoHeight = true;
}

ngAfterContentInit() {
  this.assessSlides._rtl = true;
  this.correctAnswersCount = 0;
  this.assessSlides.lockSwipes(true);
}

moveToTheNextQuestion() {
  if (!this.assessSlides.isEnd()) {
    this.assessSlides.lockSwipes(false);
    this.assessSlides.slideNext();
    this.assessSlides.lockSwipes(true);
  }
}

i find this solution : 我找到这个解决方案:

  ngAfterViewInit() {
    setTimeout(
      ()=>{
        if(this.assessSlides){
          this.assessSlides.update();
        }
      },300
    );
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM