报错:Unknown custom element: swiper-slide did you register the component correctly?

在vue中使用swiper时,提示报错:

Unknown custom element: <swiper-slide> - did you register the component correctly? For recursive components, make sure to provide the "name" option.(未知的自定义元素: -你注册的组件正确吗?对于递归组件,请确保提供“name”选项。)

尝试重新安装依赖:

报错:Unknown custom element: swiper-slide did you register the component correctly?

发现依然报错

这时还是到swiper中文网查看一下是否有更新(地址:https://www.swiper.com.cn/),在目录页选择“在Vue中使用swiper”

可以看到导入时首写字母是大写,而我的项目中是小写。

报错:Unknown custom element: swiper-slide did you register the component correctly?

做修改后运行成功!

报错:Unknown custom element: swiper-slide did you register the component correctly?