添加页面过渡效果,更新路由元信息以设置页面标题,优化页脚内容和样式

This commit is contained in:
2025-03-05 22:23:00 +08:00
parent e423b5a1d4
commit e90753a878
6 changed files with 70 additions and 14 deletions

View File

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