Vue组件循环依赖、递归

1、组件循环依赖:

A组件中有B组件,B组件中有A组件

系统报错:

Unknown custom element: <A> - did you register the component correctly? For recursive components, make sure to provide the "name" option

解决方法:

//B中调用A,使用异步加载
const A = () => import('@/components/.../A.vue');

2、组件递归:

添加name option,无需引入注册,直接在内部使用<Self />

posted @ 2022-04-13 16:37  Jade_g  阅读(381)  评论(0编辑  收藏  举报