@dabobo/utils
Version:
dabobo utils
37 lines (29 loc) • 668 B
Markdown
### Install
`yarn add @dabobo/utils` 或者 `npm i @dabobo/utils`
### Useage
```javascript
/**
declare module 'utils' {
export function createRouterMap(context: typeof require.context, exclude?: RegExp) : routerMap;
type routerMap = {
routes: Array<router>;
map: {
path: string;
uri: string;
component: object;
}
}
type router = {
path: string;
uri: string;
component: any;
children: Array<router>
}
}
**/
import { createRouterMap } from '@dabobo/utils';
const { routes } = createRouterMap(
require.context('./src/views', true, /\.vue/, 'lazy'),
/\/404\.vue/
);
```