2016-07-28 13 views

Odpowiedz

3

Swiper został zintegrowany bezpośrednio z Ionic2 ... nie wiesz, co to za pytanie?

czy można zrobić to w ten sposób Ionic 2 Slides Component - How to Access Swiper API

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

screenie - enter image description here

+1

Jeśli używam jonowe slajdy uzyskać pełną stronę suwaka. I nie może obliczyć, jak kontrolować te suwaki, na przykład, aby nie być pełną stroną. – user1275105

+0

Czy mam użyć css do przejechania tego typu funkcji (np. Slajd obejmujący cały ekran) lub czy jest jakiś rodzaj opcji, które powinienem ustawić. – user1275105

Powiązane problemy