其他分享
首页 > 其他分享> > Vue报错——did you register the component correctly? For recursive components, make sure to provide the

Vue报错——did you register the component correctly? For recursive components, make sure to provide the

作者:互联网

今天项目中遇到一个大坑,项目报错did you register the component correctly? For recursive components, make sure to provide the the "name" options,报错很容易理解,就是组件注册的方式不对,没有注册成功,仔细看了自己组件的注册,发现并没有什么问题在网上找了很久,一无所获,偶然看到一篇博客的评论,受到了启发。

评论区是这样说的:多次调用的组件使用import引入,可以让name不和父组件冲突

解决方式:

如果你在报这个错后寻找一番,发现注册方式并没有什么问题时,看看你的这个组件是否被多个父组件同时调用了,在components里这样写试试:

components: {
    Navbar: () => import('./components/Navbar'),
    content: () => import('./components/content')
 }

报错消失,问题解决!

标签:注册,Vue,recursive,sure,报错,components,组件,import
来源: https://blog.csdn.net/qq_42132814/article/details/120422204