@umijs/route-utils
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

npm package

@umijs/route-utils

Usage

# npm
npm i @umijs/route-utils --save

## yarn
yarn add @umijs/route-utils

API

import { transformRoute, getMatchMenu } from '@umijs/route-utils';

const routes = [
  {
    path: '/welcome',
    name: 'welcome',
  },
  {
    path: '/admin',
    name: 'admin',
    access: 'canAdmin',
  },
  {
    name: 'list.table-list',
    path: '/list',
  },
];

const { menuData, breadcrumb } = transformRoute(routes);

console.log(menuData[0].name); // welcome

console.log(breadcrumb.get('/welcome').name); // welcome

MenuDataItem

import { MenuDataItem } from '@umijs/route-utils';

export interface MenuDataItem {
  routes?: MenuDataItem[];
  hideChildrenInMenu?: boolean;
  hideInMenu?: boolean;
  icon?: React.ReactNode;
  locale?: string | false;
  name?: string;
  key?: string;
  pro_layout_parentKeys?: string[];
  path?: string;
  [key: string]: any;
}

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @umijs/route-utils

Weekly Downloads

86,626

Version

4.0.1

License

MIT

Unpacked Size

150 kB

Total Files

35

Last publish

Collaborators

  • xusd320
  • yifankakaxi
  • xierenyuan
  • stormslowly
  • xiefengnian
  • sorrycc
  • chenshuai2144
  • kuitos
  • peachscript
  • xiaohuoni