Skip to content

Commit

Permalink
docs: add layout param for routes.md (#12143)
Browse files Browse the repository at this point in the history
* docs: add `layout` param for `routes.md`

* docs: update

* docs: update

---------

Co-authored-by: 咲奈Sakina <[email protected]>
  • Loading branch information
nnmax and fz6m authored Feb 26, 2024
1 parent 0c561ea commit 7f5f6c7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/docs/docs/guides/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,29 @@ const TheOldPage = ()=>{
export default withAuth(TheOldPage)
```

### layout

* Type: `boolean`

通过配置 `layout: false` 可以单独关闭某一个路由的全局布局:

```js
// .umirc.ts

export default {
routes: [
// 取消 login 页面的全局布局,从而自行实现整个页面
{ path: '/login', component: '@/pages/Login', layout: false },
],
}
```

注:

1. 全局布局可能来自于 `layouts/index.tsx` 约定,或插件添加的 layout(如 `@umijs/max` 自带的 layout 插件将自动添加菜单布局),当配置 `layout: false` 时,将取消所有 layout ,此时组件内容占据整个页面,多用于登录页等场景。

2. `layout: false` 仅对一级路由生效,更多例子详见 [全局 layout](#全局-layout)

## 约定式路由

除配置式路由外,Umi 也支持约定式路由。约定式路由也叫文件路由,就是不需要手写配置,文件系统即路由,通过目录和文件及其命名分析出路由配置。
Expand Down

0 comments on commit 7f5f6c7

Please sign in to comment.