前端启动成功
This commit is contained in:
@@ -1,19 +1,109 @@
|
||||
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
|
||||
|
||||
/**
|
||||
* 基础路由配置(无需权限)
|
||||
*/
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
redirect: "/dashboard",
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "Login",
|
||||
component: () => import("@/views/Login.vue"),
|
||||
meta: {
|
||||
title: "登录",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
name: "Register",
|
||||
component: () => import("@/views/Register.vue"),
|
||||
meta: {
|
||||
title: "注册",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/forgot-password",
|
||||
name: "ForgotPassword",
|
||||
component: () => import("@/views/ForgotPassword.vue"),
|
||||
meta: {
|
||||
title: "忘记密码",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
// 主应用布局(需要权限,动态路由会添加到这里)
|
||||
{
|
||||
path: "/dashboard",
|
||||
name: "Dashboard",
|
||||
component: () => import("@/layouts/BasicLayout.vue"),
|
||||
redirect: "/dashboard/workplace",
|
||||
meta: {
|
||||
title: "工作台",
|
||||
requiresAuth: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "workplace",
|
||||
name: "DashboardWorkplace",
|
||||
component: () => import("@/views/dashboard/Workplace.vue"),
|
||||
meta: {
|
||||
title: "工作台",
|
||||
requiresAuth: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// 错误页面
|
||||
{
|
||||
path: "/403",
|
||||
name: "Forbidden",
|
||||
component: () => import("@/views/error/403.vue"),
|
||||
meta: {
|
||||
title: "403 - 无权限访问",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
name: "NotFound",
|
||||
component: () => import("@/views/error/404.vue"),
|
||||
meta: {
|
||||
title: "404 - 页面不存在",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/500",
|
||||
name: "ServerError",
|
||||
component: () => import("@/views/error/500.vue"),
|
||||
meta: {
|
||||
title: "500 - 服务器错误",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
// 旧的about路由,保持兼容
|
||||
{
|
||||
path: "/about",
|
||||
name: "about",
|
||||
// route level code-splitting
|
||||
// this generates a separate chunk (about.[hash].js) for this route
|
||||
// which is lazy-loaded when the route is visited.
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
|
||||
name: "About",
|
||||
component: () => import("@/views/AboutView.vue"),
|
||||
meta: {
|
||||
title: "关于",
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
// 捕获所有未匹配的路由
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
redirect: "/404",
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
history: createWebHistory('/schoolNewsWeb/'),
|
||||
routes,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user