报错
Uncaught Error: [vue-router] "path" is required in a route configuration.
原因
在router.js配置路由时,不能写空{},在程序里写了空{}是不报错的,运行是扫描{}中没有path时会报错
写了空{}会报错
routes: [
{
path: '/',
name: 'home',
component: Home,
redirect: '/index',
children: [
{
path: '/index',
name: 'index',
component: Index,
}
]
},
{}
]
});
正确的写法
routes: [
{
path: '/',
name: 'home',
component: Home,
redirect: '/index',
children: [
{
path: '/index',
name: 'index',
component: Index,
}
]
}
]
});
网友评论