试图让 vue-awesome-swiper 在 nuxt 通用应用程序中工作。
我的包版本:
- “刷卡器”:“^6.0.4”
- "vue-awesome-swiper": "^4.1.1",
我注册了一个插件文件(全局注册指令):vue-awesome-swiper.js
import Vue from 'vue'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/swiper-bundle.css'
Vue.use(VueAwesomeSwiper /* { default options with global component } */)
然后是我的 nuxt.config.js:
plugins: [
{ src: '~/plugins/vue-awesome-swiper', mode: 'client' },
然后是我的组件(全局注册指令):componentSwiper
<template>
<div v-swiper="swiperOption">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="1.jpg" alt="" />
</div>
<div class="swiper-slide">
<img src="2.jpg" alt="" />
</div>
<div class="swiper-slide">
<img src="3.jpg" alt="" />
</div>
<div class="swiper-slide">
<img src="4.jpg" alt="" />
</div>
<div class="swiper-slide">
<img src="5.jpg" alt="" />
</div>
<div class="swiper-slide">
<img src="6.jpg" alt="" />
</div>
<div slot="button-prev" class="swiper-button-prev"></div>
<div slot="button-next" class="swiper-button-next"></div>
</div>
</div>
</template>
<script>
export default {
name: 'componentSwiper',
data() {
return {
swiperOption: {
loop: true,
slidesPerView: 3,
spaceBetween: 30,
autoplay: {
delay: 5000
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
}
}
}
}
}
</script>
什么都没有动,什么也没有发生。我的幻灯片卡住了,所以我一定错过了什么?