vue-awesome-swiper如何在mounted里初始化options属性?

<swiper class=”swiperctn” :options=”mySwiperOption” ref=”mySwiper”>

  <!-- slides -->
  <swiper-slide>
   1
  </swiper-slide>
  <swiper-slide>
   2
  </swiper-slide>
  <swiper-slide>
  3
  </swiper-slide>
  <div class="swiper-pagination" slot="pagination"></div>
  <div class="swiper-button-prev" slot="button-prev"></div>
  <div class="swiper-button-next" slot="button-next"></div>
</swiper>

data数据里是:

mySwiperOption:{}

然后在mounted()钩子里给mySwiperOption重新写值:

mountend(){
this.swiper.mySwiperOption = {
  notNextTick:true,
    centeredSlides: true,
    slidesPerView: 1.5,
    spaceBetween: 15,
    // initialSlide:1,
    loop: true,
    
    
}
}

可是swiper组件没有发生任何变化,这是为什么呢?

回答:

重写之后需要重新init

回答:

swiper 有 init这个api么

回答:

参考http://www.swiper.com.cn/api/…
其中Basic选项init

暂无评论

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注