react-router4.0怎么实现默认加载子路由就是之前3.0的indexRoute?

如题react-router4.0怎么实现默认加载子路由就是之前3.0的indexRoute?

阅读 3.7k
1 个回答

以实现,

const routes =[
    { path: '/', component: LoginView, exact:true},
    { path: '/login', component: LoginView},
    { path: '/main', component: Main ,routes:[
        { path: '/main', component: Home, exact:true},
        // { path: '/main/home', component: Home},
        { path: '/main/about', component: About},
        { path: '/main/timeline/:status', component: TimeLine}
    ]}
]

递归生成路由

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题