遇到一个小问题,发现是name写错地方了,具体如下
ruoter.js
path: 'yourRouterPathParents',
component: Layout,
meta: { title: 'yourRouterParentsTitle' },
redirect: 'yourRouterPathChildren',
name: 'yourRouterName',
children: [
{
path: 'yourRouterPathChildren',
component: () => import('yourRouter'),
meta: { title: 'yourRouterTitle' }
},]
因为父的router重定向到了子router那里,可以正常跳转,但是params传参是不行的,query可以,所以只需要修改name的位置即可
path: 'yourRouterPathParents',
component: Layout,
meta: { title: 'yourRouterParentsTitle' },
redirect: 'yourRouterPathChildren',
name: 'yourRouterName', ---//这里删掉
children: [
{
path: 'yourRouterPathChildren',
name: 'yourRouterName', +++//加在这里
component: () => import('yourRouter'),
meta: { title: 'yourRouterTitle' }
},]