接收了一个新的react项目,使用的最新的React-router v6 需要定义二级下拉菜单,但是我的二级子路由没有出来
没搞明白这个嵌套的子路由怎么定义的
//routes.js
export const routes = [
{
key: 'DouyinTalent',
exact: true,
link: '/DouyinTalent',
path: '/DouyinTalent/*',
name: '抖音达人',
component: DouyinTalent,
children: [
{
key: 'DouyinTalent/GameRank',
exact: true,
link: '/DouyinTalent/GameRank',
path: '/DouyinTalent/GameRank',
name: '游戏榜',
component: DouyinGameRank,
},
]
}
]
//import routes from './routes.js'
<Routes>
{routes.map((route) => (
<Route
key={route.key}
exact={route.exact}
path={route.path}
element={this.renderComponent(route)}
/>
))}
</Routes>
那个通配符是不是有问题。。。