如何使用 swiper 库在 Ionic2 中创建 filmstrip/carousel

How to create a filmstrip/carousel in Ionic2 using swiper library

我正在尝试创建这样的轮播 and I can do this using this wrapper for swiper library (https://github.com/ksachdeva/angular2-swiper)

但这是否有可能通过使用纯 ionic2 及其 ion-slides 组件来实现我的目标。我更喜欢这个而不是添加另一个可能不必要的模块。不幸的是,文档并不清楚。

swiper 已直接集成到 Ionic2 中...不确定这里的问题是什么?

或者你可以这样做

import { NavController } from 'ionic-angular/index';
import { Component, ViewChild } from "@angular/core";


@Component({
  template:`
<ion-content class="has-header">
      <ion-slides  [options]="_options" #mySlider>
        <ion-slide *ngFor="let testSlide of testSlides">
          <img src="http://placehold.it/150x150">
          </ion-slide>
      </ion-slides>
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
</ion-content>
`
})
export class HomePage {

  greeting: string;
  testSlides: string[] = [];
  @ViewChild('mySlider') mySlider: any;

  constructor(private nav: NavController) {

    this._options = {
        slidesPerView:3,
        pager: true,
      nextButton: ".swiper-button-next",
      prevButton: ".swiper-button-prev",        
        onInit:()=>{
        }
     }
  setTimeout(()=>{
        for (var i=1; i<6; i++) {
            this.testSlides.push("Slide - "+i);
          }
   },100);

    }
}

Plunkr - http://plnkr.co/edit/ybmDsYICQopis88vDl37?p=preview

截图 -