当前位置:   article > 正文

vue2.0轮播图

vue2.0轮播图

1、去github官网上搜索vue-awesome-swiper

2、安装swiper插件

3、使用swiper插件

?

<template>
 <div class="swiper">
   <swiper :options="swiperOption" ref="mySwiper">
     <swiper-slide>
       <img class="swiper-img" src="../../assets/img/swiper1.jpg">
     </swiper-slide>
     <swiper-slide>
       <img class="swiper-img" src="../../assets/img/swiper2.jpg">
     </swiper-slide>
     <swiper-slide>
       <img class="swiper-img" src="../../assets/img/swiper3.jpg">
     </swiper-slide>
     <div class="swiper-pagination"  slot="pagination"></div>
   </swiper>
 </div>
</template>

<script>
export default {
  name: 'HelloSwiper',
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        autoplay: 3000        //设置自动轮播的时间 自由设置
      }
    }
  },
  computed: {
    swiper () {
      return this.$refs.mySwiper.swiper
    }
  }
}
</script>

<style scoped>
  .swiper >>> .swiper-pagination-bullet-active{    //将轮播图蓝色的小圆点变成白色
    background: white;
  }
</style>
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/250806
推荐阅读
相关标签
  

闽ICP备14008679号