12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { RouteRecordRaw, createRouter, createWebHistory } from "vue-router";
- import { useStore } from "@/store/index";
- import { createRouterGuards } from "./routerGuards";
- export const routes: RouteRecordRaw[] = [
- {
- path: "/",
- redirect: "/login",
- },
- {
- name: "login",
- path: "/login",
- component: () => import("../pages/login.vue"),
- },
- {
- name: "register",
- path: "/register",
- component: () => import("../pages/register.vue"),
- },
- {
- name: "home",
- path: "/home",
- component: () => import("../pages/home.vue"),
- children: [
- // {
- // name: 'thread',
- // path: '/thread',
- // component: () => import("../pages/thread/thread.vue")
- // },
- {
- name: 'analysis',
- path: '/analysis',
- component: () => import("../pages/analysis/index.vue")
- },
- ],
- },
- {
- name: "test",
- path: "/test",
- component: () => import("../pages/test/index.vue"),
- },
- {
- name: "testEcharts",
- path: "/testEcharts",
- component: () => import("../pages/test/echarts.vue"),
- },
- {
- name: "aitest",
- path: "/test/aitest",
- component: () => import("../pages/test/aitest.vue"),
- },
- ];
- const router = createRouter({
- scrollBehavior: () => ({ left: 0, top: 0 }),
- history: createWebHistory(),
- routes,
- });
- const { beforeEach } = createRouterGuards(router);
- console.log('添加好后的路由', beforeEach)
- router.beforeEach(beforeEach);
- export default router;
|