Files
d2-admin-start-kit/src/router/routes.js
T
liyang a60f3e5118 no message
Former-commit-id: a7c4a5db0e74c6f70083cf0d11c636e0f9b2dce4
2018-10-12 09:54:53 +08:00

68 lines
1.1 KiB
JavaScript

import demo from './modules/demo'
import layoutHeaderAside from '@/layout/header-aside'
const meta = { requiresAuth: true }
/**
* 在主框架内显示
*/
const frameIn = [
{
path: '/',
redirect: { name: 'index' },
component: layoutHeaderAside,
children: [
{
path: 'index',
name: 'index',
meta,
component: () => import('@/pages/index')
}
]
},
demo
]
/**
* 在主框架之外显示
*/
const frameOut = [
// 页面重定向使用 必须保留
{
path: '/redirect/:path*',
component: {
beforeCreate () { this.$router.replace(JSON.parse(this.$route.params.path)) },
render: h => h()
}
},
// 登录
{
path: '/login',
name: 'login',
component: () => import('@/pages/login')
}
]
/**
* 错误页面
*/
const errorPage = [
// 404
{
path: '*',
name: '404',
component: () => import('@/pages/error-page-404')
}
]
// 导出需要显示菜单的
export const frameInRoutes = frameIn
// 重新组织后导出
export default [
...frameIn,
...frameOut,
...errorPage
]