Javascript Vue路由器:嵌套动态路由
Wassup伙计们 目前,我正在与Vuex应用商店一起开发vue路由器。但是,我有一个路由,它包含两个动态参数(:id,:templateId) 我的问题是,为了使用这个嵌套的动态url,我需要在路由中定义什么。 通常我只是一级路线 索引Javascript Vue路由器:嵌套动态路由,javascript,vue.js,vue-router,Javascript,Vue.js,Vue Router,Wassup伙计们 目前,我正在与Vuex应用商店一起开发vue路由器。但是,我有一个路由,它包含两个动态参数(:id,:templateId) 我的问题是,为了使用这个嵌套的动态url,我需要在路由中定义什么。 通常我只是一级路线 索引 const路由:数组=[ { 路径:“/”, //到目前为止,没有公共和私人路线 重定向:'/login', }, { 路径:'/login', 组成部分:后勤场, }, { 路径:'/features', 组件:FeaturePage, 儿童:[ {pat
const路由:数组=[
{
路径:“/”,
//到目前为止,没有公共和私人路线
重定向:'/login',
},
{
路径:'/login',
组成部分:后勤场,
},
{
路径:'/features',
组件:FeaturePage,
儿童:[
{path:':id',component:FeaturePage,props:true}
]
},
{
路径:'/features/:id/template/:templateId',
组件:TemplatePage,
},
{
路径:'/notFound(.*),
重定向:“/features”,
},
];
试试这个
{
路径:“/features/:id”,
组件:FeaturePage,//FeaturePage应该路由视图以包含子路由器
儿童:[
//FeaturePage应该路由视图以包含子路由器
//这是一个无限循环
//不要在此路线中使用FeaturePage
//{path:,组件:FeaturePage,props:true},
{path:“其他路径/:prop”,组件:OtherPage,props:true},
{
路径:“模板/:templateId”,
组件:TemplatePage,
道具:没错,
},
],
}
您是否在有子节点(
/feature
)的路由中添加了路由器视图
?您的确切意思是什么?如果FeaturePage具有路由器视图?对
const routes: Array<RouteRecordRaw> = [
{
path: '/',
// as of now there are no public and private routes
redirect: '/login',
},
{
path: '/login',
component: LoginField,
},
{
path: '/features',
component: FeaturePage,
children: [
{path: ':id', component: FeaturePage, props: true}
]
},
{
path: '/features/:id/template/:templateId',
component: TemplatePage,
},
{
path: '/notFound(.*)',
redirect: '/features',
},
];