Vue-awesome-swiper: Why my swiper slide from the last slide?

Created on 19 Jun 2017  Â·  8Comments  Â·  Source: surmon-china/vue-awesome-swiper

Without setting the initialSlide, my swiper always slide from the last slide. As I set it to 1, it works (Slide from the first slide). Why not Zero.

swiperOption: {
    pagination: '.swiper-pagination',
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    slidesPerView: 1,
    paginationClickable: true,
    spaceBetween: 30,
    loop: true,
    autoplay: 3000,
    autoplayDisableOnInteraction: false
}
help wanted

Most helpful comment

My solution is:
swiperOption: {
...
initialSlide: 1
}

All 8 comments

I have a local test, did not find this problem, can you provide a more detailed description of it?

image

@surmon-china It arose when I used the loop (v-for).

  <swiper :options="swiperOption" ref="test" class="category_carousel">
    <swiper-slide
      v-for="(item, index) in classAdsActivity"
      :key="item.id"
      class="J_ping">
      <a :href="item.url">
        <img :src="item.image">
      </a>
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>

Me too.

image

Check if your array order is within your expectations?

@surmon-china

Note: As the array was in data, there was no problem.

mapGetters({classAdsActivity: 'classAdsActivity'}). The initial state of classAdsActivity is [].

I had same problem, fixed with
js swiperOption: { ... onInit: function (swiper) { swiper.slideTo(1) }

@surmon-china thanks for this great plugin

My solution is:
swiperOption: {
...
initialSlide: 1
}

did anyone fixed it because i am still getting same problem

Was this page helpful?
0 / 5 - 0 ratings