vue-awesome-swiper轮播插件

Posted wufenfen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue-awesome-swiper轮播插件相关的知识,希望对你有一定的参考价值。

1、安装指定的版本:
      npm i vue-awesome-swiper@3.1.3

2、在要引入轮播的页面写入:
      import { swiper, swiperSlide } from ‘vue-awesome-swiper‘;
      import ‘swiper/css/swiper.css‘;
      注册:
       components:{
          swiper,
          swiperSlide
      },

3、 <swiper v-bind:options="swiperOption">
          <swiper-slide v-for="(item, index) in slideList" v-bind:key="index">
            <a v-bind:href="‘/#/product/‘+item.id"><img v-bind:src="item.img"></a>
          </swiper-slide>
          <!-- Optional controls -->
          <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 () {
    return {
      swiperOption:{
        autoplay:true,
        loop:true,
        effect:‘cube‘,
        cubeEffect: {
          shadowOffset: 100,
          shadowScale: 0.6
        },
        pagination: {
          el: ‘.swiper-pagination‘,
          clickable:true
        },
        navigation: {
          nextEl: ‘.swiper-button-next‘,
          prevEl: ‘.swiper-button-prev‘,
        }
      },
      slideList:[
        {
          id:‘42‘,
          img:‘/imgs/slider/slide-1.jpg‘
        },
        {
          id:‘45‘,
          img:‘/imgs/slider/slide-2.jpg‘
        },
        {
          id:‘46‘,
          img:‘/imgs/slider/slide-3.jpg‘
        },
        {
          id:‘‘,
          img:‘/imgs/slider/slide-4.jpg‘
        },
        {
          id:‘‘,
          img:‘/imgs/slider/slide-1.jpg‘
        }
      ]
    }
  }

以上是关于vue-awesome-swiper轮播插件的主要内容,如果未能解决你的问题,请参考以下文章

vue轮播插件vue-awesome-swiper

使用vue-awesome-swiper轮播插件总结

轮播插件vue-awesome-swiper的基本使用

vue轮播图插件vue-awesome-swiper的使用与组件化

vue vue-awesome-swiper首页轮播图的制作

vue项目全局引入vue-awesome-swiper插件做出轮播效果