[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插件
修改router.js文件
  • 如果再次运行还是会出现错误,试着到APP.vue里面找错误,看App.vue里面是否缺<router-view></router-view>,如果缺少就填上
修改APP.vue文件
  • 修改完后,运行,错误就解决了
成功
posted @ 2020-03-30 13:16  a_哆肉  阅读(4476)  评论(0编辑  收藏  举报