2 回答

TA贡献1799条经验 获得超9个赞
在您的代码中,您仍然有一条component路线children:
{
path: '/store',
component: Dashboard,
children: [
{
path: '/products',
component: ProductsView,
},
]
},
但是,Vuejs 文档显示父路由中不应该有组件,如下所示:
const router = new VueRouter({
routes: [
{ path: '/user/:id', component: User,
children: [
{
// UserProfile will be rendered inside User's <router-view>
// when /user/:id/profile is matched
path: 'profile',
component: UserProfile
},
{
// UserPosts will be rendered inside User's <router-view>
// when /user/:id/posts is matched
path: 'posts',
component: UserPosts
}
]
}
]
})
所以,相反,你应该有:
const routes = [
{
path: '/',
component: LogInView
},
{
path: '/store',
// component: Dashboard, // <-- should be removed
children: [
{
path: 'products',
component: ProductsView,
},
]
},
{
path: '/platform',
children: [
{
path: 'products',
component: ProductsView,
},
]
},
{
path: '/platform',
component: Dashboard
} ]
@TEFO正确地指出子路由不应包含斜杠
添加回答
举报