umi4的更换layouts

layouts/index.tsx

全局布局,默认会在所有路由下生效,比如有以下路由关系:

[
{ path: '/', component: '@/pages/index' },
{ path: '/users', component: '@/pages/users' },
]

输出为:

<Layout>
<Page>index</Page>
<Page>users</Page>
</Layout>

当你需要关闭 layout 时可以使用 layout: false ,当你需要更多层 layout 时,可以考虑使用 wrappers ,仅在配置式路由可用:

routes: [
{ path: '/', component: './index', layout: false },
{
path: '/users',
component: './users',
wrappers: ['@/wrappers/auth']
}
]

posted on 2024-12-23 00:41  漫思  阅读(312)  评论(0)    收藏  举报

导航