index.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. import Index from "../views/login/index"
  5. export const constantRoutes = [{
  6. path: '/',
  7. name: "index",
  8. meta: { title: '登录' },
  9. component: Index,
  10. // component: () => import('@/views/login/index'),
  11. },
  12. {
  13. path: '/login',
  14. name: "indexLogin",
  15. meta: { title: '登录' },
  16. component: Index,
  17. // component: () => import('@/views/login/index'),
  18. },
  19. {
  20. path: '/Signup',
  21. name: "Signup",
  22. meta: { title: '注册' },
  23. component: () =>
  24. import('@/views/login/Signup'),
  25. },
  26. // 404 page must be placed at the end !!!
  27. { path: '*', redirect: '/404', hidden: true }
  28. ]
  29. const createRouter = () => new Router({
  30. // mode: 'history', // require service support
  31. scrollBehavior: () => ({ y: 0 }),
  32. routes: constantRoutes
  33. })
  34. const router = createRouter()
  35. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  36. export function resetRouter() {
  37. const newRouter = createRouter()
  38. router.matcher = newRouter.matcher // reset router
  39. }
  40. export default router