记录swiper6踩坑

新手小白,初学vue用的是vue3,然后需要用到swiper 和 vue-awesome-swiper插件,安装的是swiper6就到官网上教程https://swiperjs.com/vue/
没有全局引,直接在页面中写的

import SwiperCore, {
  Navigation,
  Pagination,
  Scrollbar,
  A11y,
  EffectCube,
  Autoplay
} from "swiper";
import { Swiper, SwiperSlide } from "swiper/vue";
import "swiper/swiper.scss";
import "swiper/components/navigation/navigation.scss";
import "swiper/components/pagination/pagination.scss";
import "swiper/components/scrollbar/scrollbar.scss";
import "swiper/components/effect-cube/effect-cube.scss";

SwiperCore.use([Navigation, Pagination, Scrollbar, A11y, EffectCube, Autoplay]);
export default {
  components: {
    Swiper,
    SwiperSlide,
  }
  }

vue3 用着都挺好的,后来因为elment-ui不支持vue3,我就换成vue2,然后swiper组件就开始报错了

[Vue warn]: Failed to mount component: template or render function not defined.

found in

---> <Swiper>
       <Index> at src/pages/Index.vue
         <Home> at src/pages/Home.vue
           <App> at src/App.vue
             <Root>

后来改成
import { Swiper, SwiperSlide } from “vue-awesome-swiper”;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值