You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
|
6 years ago
|
import Layout from "@/layout/index"
|
||
|
|
import Redirect from "@/view/app/redirect"
|
||
|
|
import Login from "@/view/app/login/index"
|
||
|
|
import Page404 from "@/view/app/404"
|
||
|
|
import Page403 from "@/view/app/403"
|
||
|
|
import {metaExtend} from "@/router/util"
|
||
|
|
|
||
|
|
const modulesFiles = require.context('./module', false, /\.js$/)
|
||
|
|
const dynamicRoutes = modulesFiles.keys().reduce((modules, modulePath) => {
|
||
|
|
const value = modulesFiles(modulePath).default
|
||
|
|
Array.isArray(value) ? modules.push(...value) : modules.push(value)
|
||
|
|
return modules
|
||
|
|
}, [])
|
||
|
|
|
||
|
|
metaExtend(dynamicRoutes)
|
||
|
|
|
||
|
|
export {dynamicRoutes}
|
||
|
|
|
||
|
|
//系统自有路由
|
||
|
|
export default [
|
||
|
|
{
|
||
|
|
path: '/redirect',
|
||
|
|
component: Layout,
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
path: ':path(.*)',
|
||
|
|
props: true,
|
||
|
|
component: Redirect
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/login',
|
||
|
|
alias: '/register',
|
||
|
|
component: Login
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/404',
|
||
|
|
component: Page404
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/403',
|
||
|
|
component: Page403
|
||
|
|
}
|
||
|
|
]
|