51 lines
1.1 KiB
TypeScript
Raw Normal View History

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