Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@fan-z/layout

shomychen47MIT1.0.7TypeScript support: included

@fan-z/layout

antd, admin, ant-design, ant-design-pro

readme

@fan-z/layout

ProLayout provides a standard, yet flexible, middle and backend layout, with one-click layout switching and automatic menu generation. It can be used with PageContainer to automatically generate breadcrumbs, page headers, and provide a low-cost solution to access the footer toolbar.

When to use

ProLayout can be used to reduce layout costs when content needs to be carried on a page.

Use with umi plugins

ProLayout works best with umi. umi automatically injects the routes from config.ts into the configured layout for us, so we don't have to write the menus by hand.

ProLayout extends umi's router configuration, adding name, icon, locale, hideInMenu, hideChildrenInMenu and other configurations, so that it is easier to generate menus in one place. The data format is as follows.

`ts | pure export interface MenuDataItem { /** @name submenu / children?: MenuDataItem[]; /* @name Hide child nodes in the menu / hideChildrenInMenu?: boolean; /* @name hideSelf and children in menu / hideInMenu?: boolean; /* @name Icon of the menu / icon?: React.ReactNode; /* @name Internationalization key for custom menus / locale?: string | false; /* @name The name of the menu / name?: string; /* @name is used to calibrate the selected value, default is path / key?: string; /* @name disable menu option / disabled?: boolean; /* @name path / path?: string; /*

  • When this node is selected, the node of parentKeys is also selected *
  • @name custom parent node / parentKeys?: string[]; /* @name hides itself and elevates child nodes to its level */ flatMenu?: boolean;

}


ProLayout will automatically select the menu based on `location.pathname` and automatically generate the corresponding breadcrumbs. If you don't want to use it, you can configure `selectedKeys` and `openKeys` yourself for controlled configuration.

## Install

Using npm:

```bash
$ npm install --save  @fan-z/layout

or using yarn:

$ yarn add @fan-z/layout

changelog

Change Log

1.0.7

  • 优化 左侧菜单文本及图标渲染结构
  • 优化 菜单字体间距等样式

    1.0.6

  • 修复 package.json内重复的依赖包

    1.0.5

    2021-12-07
  • 修复 顶部菜单配置"http"时,直接执行跳转操作不触发点击事件onClickMenu
  • 修改 将package.json内的插件包使用固定版本号(特别是@umijs/route-utils@1.0.38)

2021-12-06

  • 修复 左侧菜单可扩展配置mode='vertical'用于显示垂直菜单
  • 优化 顶部菜单样式
  • 新增 路由菜单配置添加字段subMenuType:'dropdown',用于在placeIn='top'菜单时,显示下拉dropdown菜单模式

1.0.4(删除包,因@umijs/route-utils自动更新到@2.0.4,导致路由内的children字段不存在,后面渲染菜单会出来异常)

2021-12-07

  • 修复 顶部菜单配置"http"时,直接执行跳转操作不触发点击事件onClickMenu

2021-12-06

  • 修复 左侧菜单可扩展配置mode='vertical'用于显示垂直菜单
  • 优化 顶部菜单样式
  • 新增 路由菜单配置添加字段subMenuType:'dropdown',用于在placeIn='top'菜单时,显示下拉dropdown菜单模式

1.0.3

2021-06-13

  • 更新 antd最新包@4.16.2
  • 修复 左侧菜单Menu.Item报警

1.0.2 (2021-05-10)

Note: 更新菜单样式