2

是否可以选择一张幻灯片作为初始幻灯片显示?我有一系列项目要在 Ionic 幻灯片中显示,我想根据偏好“预选”(= 将焦点放在幻灯片上)但保持顺序。

我已经阅读了 Ionic 文档,但我可能遗漏了一些东西。到目前为止,看起来我需要slideTo在页面的构造函数中使用该函数,但我正在寻找一个直接在 html 模板中使用的指令。

感谢您提供任何信息。

4

1 回答 1

3

.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,
    speed: 400
  };

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

于 2019-05-03T10:04:34.940 回答