55 lines
948 B
55 lines
948 B
/** |
|
* 读取./modules下的所有js文件并注册模块 |
|
*/ |
|
const requireModule = require.context('./modules', false, /\.js$/) |
|
const modules = [] |
|
requireModule.keys().forEach(fileName => { |
|
modules.push(requireModule(fileName).default) |
|
}) |
|
|
|
const frameIn = [ |
|
{ |
|
path: "/", |
|
redirect: "/home" |
|
}, |
|
...modules |
|
]; |
|
|
|
/** |
|
* 在主框架之外显示 |
|
*/ |
|
|
|
const frameOut = []; |
|
|
|
/** |
|
* 错误页面 |
|
*/ |
|
|
|
const errorPage = [ |
|
{ |
|
path: "/403", |
|
name: "403", |
|
meta: { |
|
title: "403" |
|
}, |
|
component: () => import("@/pages/exception/error/403") |
|
}, |
|
{ |
|
path: "*", |
|
name: "404", |
|
meta: { |
|
title: "404" |
|
}, |
|
component: () => import("@/pages/exception/error/404") |
|
} |
|
]; |
|
|
|
// 导出需要显示菜单的 |
|
export const frameInRoutes = frameIn; |
|
|
|
// 重新组织后导出 |
|
export default [ |
|
...frameIn, |
|
...frameOut, |
|
...errorPage |
|
]; |