Skip to content

Commit

Permalink
🐲 : export MenuDataItem type
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed May 6, 2020
1 parent 82e0a21 commit ace54fa
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,64 @@
# @umi-material/@umijs/route-utils

## Usage

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

## Usage
## yarn
yarn add @umijs/route-utils
```

## API

```tsx
import {
transformRoute,
getMatchMenu,
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

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

```sh
umi block https://github.com//tree/master/@umijs/route-utils
export interface MenuDataItem {
children?: MenuDataItem[];
hideChildrenInMenu?: boolean;
hideInMenu?: boolean;
icon?: React.ReactNode;
locale?: string | false;
name?: string;
key?: string;
parentKeys?: string[];
path?: string;
[key: string]: any;
}
```

## LICENSE
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { MenuDataItem } from './types';

export { default as transformRoute } from './transformRoute/transformRoute';
export { default as getFlatMenus } from './getFlatMenus/getFlatMenus';
export { default as getMatchMenu } from './getMatchMenu/getMatchMenu';

export type { MenuDataItem }

0 comments on commit ace54fa

Please sign in to comment.