Files
lingji-work-fe/src/router/index.ts

58 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-06-16 14:42:26 +08:00
/*
2025-06-23 03:16:55 -04:00
* @Author: RenXiaoDong
* @Date: 2025-06-22 22:59:16
2025-06-16 14:42:26 +08:00
*/
import { createRouter, createWebHistory } from 'vue-router';
import { appRoutes } from './routes';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
2025-07-07 18:17:31 +08:00
import { MENU_GROUP_IDS } from './constants';
2025-06-16 14:42:26 +08:00
import createRouteGuard from './guard';
NProgress.configure({ showSpinner: false }); // NProgress Configuration
2025-07-07 18:17:31 +08:00
export const router = createRouter({
2025-06-16 14:42:26 +08:00
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
2025-06-17 11:18:39 +08:00
path: '/login',
2025-06-23 01:46:41 -04:00
name: 'UserLogin',
2025-07-25 15:11:57 +08:00
component: () => import('@/views/components/login/index.vue'),
2025-06-23 03:16:55 -04:00
meta: {
requiresAuth: false,
2025-07-08 16:55:04 +08:00
requireLogin: false,
2025-06-23 03:16:55 -04:00
},
2025-06-17 11:18:39 +08:00
},
{
2025-06-23 23:59:08 -04:00
path: '/',
name: 'Home',
2025-07-25 15:11:57 +08:00
component: () => import('@/views/components/workplace/index.vue'),
2025-06-22 22:52:03 -04:00
meta: {
hideSidebar: true,
2025-07-08 16:55:04 +08:00
requiresAuth: false,
requireLogin: true,
2025-07-07 18:17:31 +08:00
id: MENU_GROUP_IDS.WORK_BENCH_ID,
2025-06-22 22:52:03 -04:00
},
2025-06-16 14:42:26 +08:00
},
2025-08-07 18:05:27 +08:00
...appRoutes,
2025-06-16 14:42:26 +08:00
{
2025-08-07 18:05:27 +08:00
path: '/:pathMatch(.*)*',
name: 'notFound',
component: () => import('@/layouts/NotFound.vue'),
2025-06-23 03:16:55 -04:00
meta: {
requiresAuth: false,
2025-08-07 18:05:27 +08:00
hideInMenu: true,
hideSidebar: true,
2025-06-23 03:16:55 -04:00
},
},
2025-06-16 14:42:26 +08:00
],
scrollBehavior() {
return { top: 0 };
},
});
createRouteGuard(router);
export default router;