[Vue warn]: Unknown custom element: <router-vue> - did you register the component correctly? For recursive components, make sure to provide the "name" option.问题的解决方法
通过vuecli学习路由封装的时候出现如下错误:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Unknown custom element: <router-vue> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <App> at src/App.vue
<Root>
解决方法:
报错提示是因为没有注册路由出现的错误,所以我们应该要先从router.js中开始找
- 在router.js中导入路由,注册router插件
- 如果再次运行还是会出现错误,试着到APP.vue里面找错误,看App.vue里面是否缺
<router-view></router-view>
,如果缺少就填上
- 修改完后,运行,错误就解决了