-
Notifications
You must be signed in to change notification settings - Fork 47
/
router.js
32 lines (26 loc) · 748 Bytes
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* @Author: fzf404
* @Date: 2022-05-25 23:18:50
* @LastEditors: fzf404 [email protected]
* @LastEditTime: 2022-09-08 18:57:58
* @Description: router 配置
*/
import { pluginList } from '#/plugin'
import { createRouter, createWebHashHistory } from 'vue-router'
const isDebug = process.env.NODE_ENV === 'development'
// 生产模式 & debug 不开启插件
const pluginLists = pluginList.filter(({ debug }) => !(!isDebug && debug))
// 自动生成 router
const routes = pluginLists.map((item) => {
return {
name: item.name,
path: '/' + item.name,
component: () => import('./plugins/' + item.name),
}
})
// 创建路由
const router = createRouter({
history: createWebHashHistory(),
routes,
})
export default router