mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-06 04:00:06 +08:00
106 lines
2.4 KiB
JavaScript
106 lines
2.4 KiB
JavaScript
import Login from '@/pages/login/Login'
|
|
import TabsView from '@/layouts/tabs/TabsView'
|
|
import BlankView from '@/layouts/BlankView'
|
|
import PageView from '@/layouts/PageView'
|
|
|
|
const options = {
|
|
routes: [
|
|
{
|
|
path: '/login',
|
|
name: '登录页',
|
|
component: Login
|
|
},
|
|
{
|
|
path: '*',
|
|
name: '404',
|
|
component: () => import('@/pages/exception/404'),
|
|
},
|
|
{
|
|
path: '/',
|
|
name: '首页',
|
|
component: TabsView,
|
|
redirect: '/login',
|
|
children: [
|
|
{
|
|
path: 'demo',
|
|
name: '演示页0',
|
|
meta: {
|
|
icon: 'file-ppt'
|
|
},
|
|
component: () => import('@/pages/demo')
|
|
},
|
|
{
|
|
path: 'parent1',
|
|
name: '父级路由1',
|
|
meta: {
|
|
icon: 'dashboard'
|
|
},
|
|
component: BlankView,
|
|
children: [
|
|
{
|
|
path: 'demo1',
|
|
name: '演示页面1',
|
|
component: () => import('@/pages/demo'),
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: 'parent2',
|
|
name: '父级路由2',
|
|
meta: {
|
|
icon: 'form'
|
|
},
|
|
component: PageView,
|
|
children: [
|
|
{
|
|
path: 'demo2',
|
|
name: '演示页面2',
|
|
component: () => import('@/pages/demo'),
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: 'exception',
|
|
name: '异常页',
|
|
meta: {
|
|
icon: 'warning',
|
|
},
|
|
component: BlankView,
|
|
children: [
|
|
{
|
|
path: '404',
|
|
name: 'Exp404',
|
|
component: () => import('@/pages/exception/404')
|
|
},
|
|
{
|
|
path: '403',
|
|
name: 'Exp403',
|
|
component: () => import('@/pages/exception/403')
|
|
},
|
|
{
|
|
path: '500',
|
|
name: 'Exp500',
|
|
component: () => import('@/pages/exception/500')
|
|
}
|
|
]
|
|
},
|
|
]
|
|
}
|
|
]
|
|
}
|
|
|
|
// 不需要登录拦截的路由配置
|
|
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} |