Files
Mainpage/src/router/index.js

32 lines
667 B
JavaScript
Raw Normal View History

import { createRouter, createWebHistory } from "vue-router";
2025-03-01 21:30:49 +08:00
const routes = [
2025-03-03 19:59:03 +08:00
{
path: "/",
name: "home",
component: () => import("@/views/HomeView.vue"),
meta: { hideFooter: true, title: "主页" },
2025-03-03 19:59:03 +08:00
},
{
path: "/links",
name: "links",
component: () => import("@/views/LinksView.vue"),
meta: { title: "友链" },
},
];
2025-03-01 21:30:49 +08:00
const router = createRouter({
history: createWebHistory(),
routes,
});
router.beforeEach((to, from, next) => {
const title = to.meta.title; // 获取路由元信息中的标题
if (title) {
document.title = "Kisechan | " + title; // 设置页面标题
}
next();
});
2025-03-01 21:30:49 +08:00
export default router;