通過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>,如果缺少就填上
- 修改完后,運行,錯誤就解決了
