import { createRouter, createWebHistory, } from 'vue-router' import Login from '../pages/login.vue'; export const routes = [ { path: '/', redirect: '/login' }, { name: 'login', path: '/login', component: Login }, { 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: "test", path: "/test", component: () => import("../pages/test/index.vue") }, { name: "testEcharts", path: "/testEcharts", component: () => import("../pages/test/echarts.vue") } ] const router = createRouter({ scrollBehavior: () => ({ left: 0, top: 0 }), history: createWebHistory(), routes, }) router.beforeEach((_to, _from, next) => { next() }) export default router