vue-router 的redirect参数传递

1、vue-router 做嵌套路由传值的时候,跳转到product页面的时候,已经能够收到传过来的值,但是我想跳的是默认ProA ,做了redirect重定向,能够跳转到ProA页面,但是product获取不到传过来的值,比如说id的值,这种情况要怎么解决?

  routes: [{            path: '/',            name: 'Index',            component: Index
        },
        {            path: '/product/:id',            name: 'Product',            redirect: '/product/:id/producta',            component: Product,            children: [{                path: 'producta',                name: 'ProA',                component: ProA
            }, {                path: 'productb',                name: 'ProB',                component: ProB
            }, {                path: 'productc',                name: 'ProC',                component: ProC
            }]
        }
    ]
慕婉清6462132
浏览 1964回答 2
2回答

xxxx1111

你这问题解决了吗,我跟你同样的问题

慕姐8265434

routes: [{            path: '/',            name: 'Index',            component: Index         },         {            path: '/product/:id',            name: 'Product',            redirect: '/product/producta/:id',            component: Product         },         {            path: '/product/producta/:id',            name: 'ProA',            component: ProA         }, {            path: '/product/productb',            name: 'ProB',            component: ProB         }, {            path: '/product/productc',            name: 'ProC',            component: ProC         }     ]
打开App,查看更多内容
随时随地看视频慕课网APP