【发布时间】:2018-11-26 09:02:26
【问题描述】:
我使用 I 路由器在组件之间进行路由 我使用子路由在页面中路由,但我丢失了我在父级中传递的参数
这是我的路由器定义:
export default new Router({
mode: 'history',
routes: [
{
path: '/management', name: 'Management', component: Management,
children: [
{
path: '/managementFlow/:confType',
component: ManagementFlow,
children: [
{
path: '/listConfiguration/:type',
component: ListConfiguration,
props: true
},
{
path: '/bulkConfiguration/:type',
component: BulkConfiguration,
props: true
},
],
props: true,
},
]
},
],
})
当我与父级一起使用时 - to:"/managementFlow/myConfType" 我得到了 confType。 我在 props 中得到值:["confType"],
但是当我将父级路由到子级时,我丢失了参数 confType
pathForRouting = `/listConfiguration/${this.type}`;
this.$router.push({
path: pathForRouting
});
我只在孩子身上得到参数: 道具:[“类型”],
【问题讨论】:
-
你孩子的完整路径是什么?
/management/managementFlow/:confType/listConfiguration/:type? -
对,这是全名,但在链接中我只看到 /listConfiguration/MyType
-
如果我可以为 confType 和 type 使用相同的值,我是一个解决方案,如果我将名称更改为相同 - 敌人示例:confType to type,它会很好用
-
“但是当我在父节点路由到子节点时”——你是怎么做到的?
-
我在代码中添加了
标签: vue.js vue-router