mirror of
https://github.com/iczer/vue-antd-admin.git
synced 2025-10-14 13:16:42 +08:00
39 lines
774 B
JavaScript
39 lines
774 B
JavaScript
import routerMap from './router.map'
|
|
import {parseRoutes} from '@/utils/routerUtil'
|
|
|
|
// 异步路由配置
|
|
const routesConfig = [
|
|
'login',
|
|
'root',
|
|
{
|
|
router: 'exp404',
|
|
path: '*',
|
|
name: '404'
|
|
},
|
|
{
|
|
router: 'exp403',
|
|
path: '/403',
|
|
name: '403'
|
|
}
|
|
]
|
|
|
|
const options = {
|
|
routes: parseRoutes(routesConfig, routerMap)
|
|
}
|
|
|
|
// 不需要登录拦截的路由配置
|
|
const loginIgnore = {
|
|
names: ['404'], //根据路由名称匹配
|
|
paths: ['/login'], //根据路由fullPath匹配
|
|
/**
|
|
* 判断路由是否包含在该配置中
|
|
* @param route vue-router 的 route 对象
|
|
* @returns {boolean}
|
|
*/
|
|
includes(route) {
|
|
return this.names.includes(route.name) || this.paths.includes(route.path)
|
|
}
|
|
}
|
|
|
|
export {options, loginIgnore}
|