vue项目中使用Swiper


安装

npm install vue-awesome-swiper -save 或者  yarn add vue-awesome-swiper

使用

全局注册没问题

import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
Vue.use(VueAwesomeSwiper)
局部页面注册会报错,原因暂时未知。

 

 

页面调用
 <swiper ref="mySwiper" :options="swiperOptions" class="my-swiper">
      <swiper-slide> <img src="index.png" /> </swiper-slide>
</swiper>    
  export default {
    name: "screen",
    components: {},
    data () {
      return {
          swiperOptions:{
            // 轮播图的方向,也可以是vertical方向horizontal
            direction:'vertical',
            //播放速度
            loop: true,
             //自动播放
            autoplay: {
                delay: 3000,
                stopOnLastSlide: false,
                disableOnInteraction: true,
            },
            // 播放的速度
            speed:2000,
          },
      }
    },
    computed: {},
    mounted(){},
    methods: {}
  }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM