index.ts 882 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';
  2. import NProgress from 'nprogress'; // progress bar
  3. import 'nprogress/nprogress.css';
  4. import { appRoutes } from './routes';
  5. import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base';
  6. import createRouteGuard from './guard';
  7. NProgress.configure({ showSpinner: false }); // NProgress Configuration
  8. const router = createRouter({
  9. //history: createWebHistory(),
  10. history: createWebHashHistory(),
  11. routes: [
  12. {
  13. path: '/',
  14. redirect: 'login',
  15. },
  16. {
  17. path: '/login',
  18. name: 'login',
  19. component: () => import('@/views/login/index.vue'),
  20. meta: {
  21. requiresAuth: false,
  22. },
  23. },
  24. ...appRoutes,
  25. REDIRECT_MAIN,
  26. NOT_FOUND_ROUTE,
  27. ],
  28. scrollBehavior() {
  29. return { top: 0 };
  30. },
  31. });
  32. createRouteGuard(router);
  33. export default router;