|
@@ -3,51 +3,98 @@ import { registerBeforeRouter } from './guard'
|
|
|
export const homeIndex = () => import('@/views/home/index.vue')
|
|
|
export const Layout = () => import('@/layout/index.vue')
|
|
|
|
|
|
-const router = createRouter({
|
|
|
- history: createWebHistory(import.meta.env.BASE_URL),
|
|
|
- routes: [
|
|
|
- {
|
|
|
- path: '/redirect',
|
|
|
- component: Layout,
|
|
|
- meta: { hidden: true },
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: '/redirect/:path(.*)',
|
|
|
- component: () => import('@/views/redirect/index.vue')
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/login',
|
|
|
- name: 'Login',
|
|
|
- meta: { title: '系统登录' },
|
|
|
- component: () => import('@/views/login/index.vue')
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/',
|
|
|
- component: Layout,
|
|
|
- name: 'Layout',
|
|
|
- meta: { breadcrumb: false },
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: '/',
|
|
|
- name: 'Dashboard',
|
|
|
- meta: {
|
|
|
- title: 'dashboard',
|
|
|
- affix: true,
|
|
|
- keepAlive: true,
|
|
|
- alwaysShow: false
|
|
|
- },
|
|
|
- component: () => import('@/views/home/index.vue')
|
|
|
+// 静态路由
|
|
|
+export const constantRoutes = [
|
|
|
+ {
|
|
|
+ path: '/redirect',
|
|
|
+ component: Layout,
|
|
|
+ meta: { hidden: true },
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ path: '/redirect/:path(.*)',
|
|
|
+ component: () => import('@/views/redirect/index.vue')
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ name: 'Login',
|
|
|
+ meta: { title: '系统登录' },
|
|
|
+ component: () => import('@/views/login/index.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/',
|
|
|
+ component: Layout,
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ path: '/',
|
|
|
+ name: 'dashboard',
|
|
|
+ meta: {
|
|
|
+ title: 'dashboard',
|
|
|
+ affix: true,
|
|
|
+ keepAlive: true,
|
|
|
+ alwaysShow: false
|
|
|
},
|
|
|
- {
|
|
|
- path: '/system',
|
|
|
- name: 'system',
|
|
|
- meta: { title: 'system' }
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
+ component: () => import('@/views/home/index.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system',
|
|
|
+ name: 'system'
|
|
|
+ // children: [
|
|
|
+ // {
|
|
|
+ // path: '/system/menus',
|
|
|
+ // meta: { title: 'menus' },
|
|
|
+ // component: () => import('@/views/system/menus/index.vue')
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // path: '/system/role',
|
|
|
+ // meta: { title: 'role' },
|
|
|
+ // component: () => import('@/views/system/role/index.vue')
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // path: '/system/dict',
|
|
|
+ // meta: { title: 'dict' },
|
|
|
+ // component: () => import('@/views/system/dict/index.vue')
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // path: '/system/dictData',
|
|
|
+ // meta: { title: 'dictData' },
|
|
|
+ // component: () => import('@/views/system/dictData/index.vue')
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // path: '/system/config',
|
|
|
+ // meta: { title: 'config' },
|
|
|
+ // component: () => import('@/views/system/config/index.vue')
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // path: '/system/module',
|
|
|
+ // meta: { title: 'module' },
|
|
|
+ // component: () => import('@/views/system/module/index.vue')
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '401',
|
|
|
+ component: () => import('@/views/error-page/401.vue'),
|
|
|
+ meta: { hidden: true }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '404',
|
|
|
+ component: () => import('@/views/error-page/404.vue'),
|
|
|
+ meta: { hidden: true }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+/**
|
|
|
+ * 创建路由
|
|
|
+ */
|
|
|
+const router = createRouter({
|
|
|
+ history: createWebHistory(),
|
|
|
+ routes: constantRoutes,
|
|
|
+ // 刷新时,滚动条位置还原
|
|
|
+ scrollBehavior: () => ({ left: 0, top: 0 })
|
|
|
})
|
|
|
registerBeforeRouter(router)
|
|
|
export default router
|