diff --git a/src/router/index.js b/src/router/index.js index e69de29..2cdc813 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -0,0 +1,63 @@ +import { createRouter, createWebHistory } from 'vue-router' +import Layout from '../layout/Layout.vue' + +const routes = [ + { path: '/', + redirect: '/userPermissions/market' + }, + { + path: '/login', + name: 'login', + component: () => import('../views/Login.vue'), + meta: { title: '登录', hiddenSidebar: true } + }, + { + path: '', + component: Layout, + children: [ + { + path: 'userPermissions', + name: 'userPermissions', + meta: { title: '用户权限管理', icon: "UserFilled", showSidebar: true, isParentNav: true }, + children: [ + { + path: 'market', + name: 'market', + component: () => import('../views/UserPermissions/Market.vue'), + meta: { title: '行情期限', showSidebar: true } + }, + { + path: 'module', + name: 'module', + component: () => import('../views/UserPermissions/Module.vue'), + meta: { title: '模块期限', showSidebar: true } + }, + { + path: 'logDeepexplore', + name: 'logDeepexplore', + component: () => import('../views/UserPermissions/LogDeepExplore.vue'), + meta: { hidden: true } + }, + { + path: 'logDeepMate', + name: 'logDeepMate', + component: () => import('../views/UserPermissions/LogDeepMate.vue'), + meta: { hidden: true } + } + ] + } + ] + } +] + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes +}) + +router.beforeEach((to, from, next) => { + if (to.meta.title) document.title = to.meta.title + next() +}) + +export default router \ No newline at end of file