# kiwi-auto-router

> vue自动路由生成

Latest version **1.0.1** (published 2022-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install kiwi-auto-router
pnpm add kiwi-auto-router
yarn add kiwi-auto-router
bun add kiwi-auto-router
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-06-28 |
| First published | 2022-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.9 |
| Dependencies | 2 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | zhaojiwei |
| Maintainers | zhaojiwei |
| Keywords | kiwi-auto-router, 自动路由, 路由, auto-router, router |

## Links

- npm: https://www.npmjs.com/package/kiwi-auto-router
- Repository: https://github.com/ZhaoJiWei0228/kiwi-auto-router
- Homepage: https://github.com/ZhaoJiWei0228/kiwi-auto-router#readme
- Issues: https://github.com/ZhaoJiWei0228/kiwi-auto-router/issues
- npm.io page: https://npm.io/package/kiwi-auto-router

## Dependencies (2)

- [prettier](https://npm.io/package/prettier.md) ^2.3.2
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.7

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-06-28
- 1.0.0 — 2022-06-28

## README

#kiwi-auto-router

# 一、简介
vue自动路由生成
### kiwi-auto-router 基于VueRouter自动化路由

# 二、使用方法
### 安装

```sh
npm i kiwi-auto-router
```

### webpack 使用 （vue-cli4为例）
```html
const autoRouter = require('kiwi-auto-router/lib/router-webpack-plugin')
configureWebpack(config) {
config.plugins = [
...config.plugins,
// eslint-disable-next-line new-cap
new autoRouter({
pages: 'src/views/autoRouter',
importPrefix: '@/views/autoRouter',
routePath: 'src/router/routes.js'
})
]
}
```

| 属性            | 描述                                                                                           | 类型   | 是否必选 | 默认值         |
| --------------- | ---------------------------------------------------------------------------------------------- | ------ | -------- | -------------- |
| pages           | 需要自动生成文件的目录                                                                         | String | 否       |                | 'src/views' |
| importPrefix    | import 引入页面文件的前缀目录                                                                  | String | 否       | '@/views'      |
| layout          | 处理成布局文件的文件名                                                                   | String | 否       | '\_layout.vue' |
| routePath       | 路由生成的文件目录，如果设置了则会在当前项目指定目录生成路由文件，否则可以从`kiwi-auto-route`导入 kiwi-auto-router/lib/routes | String | 否       | 无             |


其中`meta`为`vue-router`配置的`meta`属性一致
写在每个组件的export default {}中
```
meta: {
    title: '系统管理',
    icon: 'form',
    permissionArray: [1, 2, 3],
    sortIndex: 1,
    newTime: '2022-05-20'
  }
```


```

#### 路由文件配置

```js
// 路由初始化
import routes from './routes'

const createRouter = () => new Router({
  mode: 'history', // require service support
  base: process.env.BASE_URL,
  scrollBehavior: () => ({ y: 0 }),
  routes
})

```

# 三、版本信息
1.0.0 init porject

---
_Source: https://npm.io/package/kiwi-auto-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
