|
@@ -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'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 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
|