path:'index',component:indexComponent,children:[
{path:"main",component:mainComponent},
{path:'',redirectTo...:'/main',pathMatch:'full'}
]},
{path:'',redirectTo:'/index',pathMatch:'full'}
];
@NgModule({
imports...RouterModule],
})
export class MyRoutingModule { }
我的情况是在父组件中调用子路由的时候,出现这个问题的,大家只需要更改一个地方,
{path:'',redirectTo