请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

打开根目录没有默认记载home页面

{
path: ‘/’,
name: ‘Home’,
component:Home
},
{
path: ‘/login’,
name: ‘Login’,
component: Login
},
跟课堂代码一致,但是这样打开根目录没有默认加载home页面,如果path: ‘/home’,是可以单独访问,不知道为什么,控制台打印:
vue-router.esm-bundler.js?6c02:71 [Vue Router warn]: Component “default” in record with path “undefined” is not a valid component. Received “undefined”.
warn @ vue-router.esm-bundler.js?6c02:71
extractComponentsGuards @ vue-router.esm-bundler.js?6c02:1941
eval @ vue-router.esm-bundler.js?6c02:3004
Promise.then (async)
navigate @ vue-router.esm-bundler.js?6c02:2999
pushWithRedirect @ vue-router.esm-bundler.js?6c02:2894
push @ vue-router.esm-bundler.js?6c02:2833
install @ vue-router.esm-bundler.js?6c02:3210
use @ runtime-core.esm-bundler.js?5c40:2945
eval @ main.js?56d7:10
./src/main.js @ app.js:1261
webpack_require @ app.js:849
fn @ app.js:151
1 @ app.js:1549
webpack_require @ app.js:849
checkDeferredModules @ app.js:46
(anonymous) @ app.js:925
(anonymous) @ app.js:928
vue-router.esm-bundler.js?6c02:71 [Vue Router warn]: Unexpected error when starting the router: Error: Invalid route component
at extractComponentsGuards (vue-router.esm-bundler.js?6c02:1945)
at eval (vue-router.esm-bundler.js?6c02:3004)
warn @ vue-router.esm-bundler.js?6c02:71
eval @ vue-router.esm-bundler.js?6c02:3212
Promise.catch (async)
install @ vue-router.esm-bundler.js?6c02:3210
use @ runtime-core.esm-bundler.js?5c40:2945
eval @ main.js?56d7:10
./src/main.js @ app.js:1261
webpack_require @ app.js:849
fn @ app.js:151
1 @ app.js:1549
webpack_require @ app.js:849
checkDeferredModules @ app.js:46
(anonymous) @ app.js:925
(anonymous) @ app.js:928

正在回答 回答被采纳积分+3

1回答

Dell 2021-01-24 00:32:46

是不是没有export default 导出内容啊

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号