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   漫思  阅读(82)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 没有源码,如何修改代码逻辑?
· NetPad:一个.NET开源、跨平台的C#编辑器
历史上的今天:
2022-12-23 MariaDB 公司正式在纽交所上市
2022-12-23 当谈论 React hook,我们究竟说的是什么?

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示