index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. import { constantRouterMap } from '@/router/config'
  4. Vue.use(Router)
  5. /**
  6. * Note: sub-menu only appear when route children.length >= 1
  7. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  8. *
  9. * hidden: true if set true, item will not show in the sidebar(default is false)
  10. * alwaysShow: true if set true, will always show the root menu
  11. * if not set alwaysShow, when item has more than one children route,
  12. * it will becomes nested mode, otherwise not show the root menu
  13. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  14. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  15. * meta : {
  16. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  17. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  18. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  19. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  20. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  21. }
  22. */
  23. /**
  24. * constantRoutes
  25. * a base page that does not have permission requirements
  26. * all roles can be accessed
  27. */
  28. // export default router
  29. /* mode: 'history',*/
  30. export default new Router({
  31. scrollBehavior: () => ({ y: 0 }),
  32. routes: constantRouterMap
  33. })