赞
踩
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>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。