import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; import Login from "@/views/login/index.vue"; //登录组件 import Layout from "@/views/layout/index.vue"; //首页布局 import CallBack from "@/views/login/OauthCallBack.vue"; //反馈页面 import Home from '@/views/home/index.vue'; //家 import Auth from '@/views/role/pages/Auth.vue'; //权限管理 const routes: Array = [ { path: "/", name: "Login", component: Login, }, { path: "/callback", name: "CallBack", component: CallBack, }, { path: "/layout", name: "Layout", component: Layout, children:[ { path:'', name:'home', component:Home, }, // 后续用动态菜单 { path:'role', name:'roleAuth', component:Auth } ] }, ]; const router = createRouter({ history: createWebHistory(), routes, }); // 在这里添加路由的导航守卫 router.beforeEach((to, from, next) => { console.log("Navigating to:", to.path); next(); }); export default router;