这篇文章主要介绍了vue引入新版 vue-awesome-swiper插件填坑问题,现在分享给大家,也给大家做个参考。
本文介绍了关于新版 vue-awesome-swiper,分享给大家,具体如下:
问题
为什么我的vue-awesome-swiper组件pagination小圆点不显示问题?
-
为什么我的vue-awesome-swiper不会自动播放?
立即学习“前端免费学习笔记(深入)”;
为什么我的vue-awesome-swiper没有?
使用
引入(前面的步骤和往常一样)
npm install vue-awesome-swiper --save
在 main,js 里引入(全局):
import VueAwesomeSwiper from 'vue-awesome-swiper' Vue.use(VueAwesomeSwiper) import 'swiper/dist/css/swiper.css'
(css 不显示的问题可能就在这)
组件里引入:
import 'swiper/dist/css/swiper.css' //在全局没引入,这里记得要!
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
components: {
swiper,
swiperSlide
}
}配置
template:
I'm Slide 1 I'm Slide 2 I'm Slide 3
script:
export default {
data() {
return {
swiperOption: {
// 所有的参数同 swiper 官方 api 参数一样
//
}
}
},
...
}重点在于 swiperOption 里面的变化,区别看下图:

原来 pagination 和 autoplay 要这样配置!
我原来就是在这两处错了,导致 pagination 不显示,图片不轮播。
出错前:

纠正后:

总结
vue-awesome-swiper官网其实早放出说明来了,但自己一看全是英文,就没想看下去。后来发其实很容易看懂得,吸取教训自己多去看看文档,不要找 demo 去抄。
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:










