@umijs/route-utils

umi route utils

Showing:

Popularity

Downloads/wk

20.6K

GitHub Stars

27

Maintenance

Last Commit

5mos ago

Contributors

4

Package

Dependencies

4

Size (min+gzip)

6.7KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Readme

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
import { MenuDataItem } from '@umijs/route-utils';

export interface MenuDataItem {
  children?: 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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100