You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB
JavaScript

8 years ago
import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
8 years ago
/* layout */
8 years ago
import Layout from '../views/layout/Layout'
8 years ago
8 years ago
Vue.use(Router)
8 years ago
/**
* icon : the icon show in the sidebar
* hidden : if `hidden:true` will not show in the sidebar
* redirect : if `redirect:noredirect` will not redirct in the levelbar
* noDropdown : if `noDropdown:true` will not has submenu in the sidebar
* meta : `{ role: ['admin'] }` will control the page role
**/
8 years ago
export const constantRouterMap = [
{ path: '/login', component: _import('login/index'), hidden: true },
{ path: '/404', component: _import('404'), hidden: true },
8 years ago
{
path: '/',
component: Layout,
redirect: '/dashboard',
name: 'Dashboard',
8 years ago
hidden: true,
children: [{ path: 'dashboard', component: _import('dashboard/index') }]
},
8 years ago
{
path: '/example',
component: Layout,
redirect: 'noredirect',
8 years ago
name: 'Example',
icon: 'zujian',
8 years ago
children: [
{ path: 'index', name: 'Form', icon: 'zonghe', component: _import('page/form') }
8 years ago
]
},
8 years ago
8 years ago
{
path: '/table',
component: Layout,
redirect: '/table/index',
8 years ago
icon: 'tubiao',
8 years ago
noDropdown: true,
children: [{ path: 'index', name: 'Table', component: _import('table/index'), meta: { role: ['admin'] }}]
8 years ago
},
8 years ago
8 years ago
{ path: '*', redirect: '/404', hidden: true }
8 years ago
]
export default new Router({
// mode: 'history', //后端支持可开
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
})