Skip to content

关于路由component和redirect有子routes将会坏死 #12196

Answered by fz6m
ByYogi asked this question in Q&A
Discussion options

You must be logged in to vote

如果有 redirect ,umi 就自动把这个路由的组件给变成用于重定向的组件了,所以没法有 routes 子路由。

如果有 component ,那这个 component 就展示在这个层级了,如果还想同时有 routes (子路由),就需要在 component 组件里用 <Outlet /> 去展示子路由(来自于 umi 4 使用的 react router v6 的设定),如果不需要子路由就没必要配置 routes ,如果需要嵌套子路由,就自行添加 <Outlet /> 到父路由,或者你不在父路由添加 component 这个字段也可以。

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ByYogi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants