我正在用yarn add swiper安装swiper.js
这是我的代码,但未显示任何幻灯片或其他内容
<swiper
:slides-per-view="3"
:space-between="50"
@swiper="onSwiper"
@slideChange="onSlideChange"
>
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
</swiper>
错误这样说
[Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <Swiper>
<DetailProduct>
<App> at src/App.vue
<Root>
这是我对package.json的依赖
"dependencies": {
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.18.1",
"core-js": "^3.7.0",
"node-sass": "^4.14.1",
"numeral": "^2.0.6",
"sass-loader": "^10.0.5",
"swiper": "^6.3.5",
"vue": "^2.6.11",
"vue-router": "^3.4.9",
"vue-toast-notification": "^0.5.4",
"vuex": "^3.4.0"
}
我如何在Vue中使用swiper.js。希望你能帮助我,谢谢:)
您是否在组件中导入了swiper?
// Import Swiper Vue.js components
import { Swiper, SwiperSlide } from 'swiper/vue';
export default {
components: {
Swiper,
SwiperSlide,
},
...
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句