Vue报错--组件循环引用(两个组件同时引用另一个组件时)

347 阅读1分钟

项目中遇到一个问题,在两个页面中同时引用另一个组件时,控制台提示报错信息“did you register the component correctly? For recursive components, make sure to provide the "name" option.

仔细检查,发现组件的注册没有什么问题。
网上查找资料发现一篇帖子:blog.csdn.net/qq_42132814…

问题的原因可能是组件同时被多个父组件调用了,在components中通过以下方式引用可以解决。

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