vue 组件互想嵌套报错
vue两个组件互相嵌套,你中有我,我中有你,互为对方的父组件和子组件。然后某个组件就会报错:[Vue warn]: Unknown custom element: <组件名> - did you register the component correctly? For recursive components, make sure to provide the "name" opti
·
vue两个组件互相嵌套,你中有我,我中有你,互为对方的父组件和子组件。然后某个组件就会报错:[Vue warn]: Unknown custom element: <组件名> - did you register the component correctly? For recursive components, make sure to provide the "name" option.百度了下,大部分网友都给支招,直接在main.js中注册组件可以破局。然而,我不喜欢这样的方式。。。。。。。。。。
经过几番查找,终于有个哥们甩了个链接:官方指导
哇,解决问题方法get!
或者,在本地注册组件的时候,你可以使用 webpack 的异步 import
:
components: {
TreeFolderContents: () => import('./tree-folder-contents.vue')
}
这样问题就解决了!
官方好牛,请接收小菜鸟的膜拜。
更多推荐
已为社区贡献1条内容
所有评论(0)