chore: init

This commit is contained in:
2025-11-11 14:15:40 +08:00
commit 867beb5de7
17 changed files with 3144 additions and 0 deletions

39
src/router/index.js Normal file
View File

@@ -0,0 +1,39 @@
import { createRouter, createWebHistory } from 'vue-router';
import BattleRanking from '../views/BattleRanking.vue';
import AdminPanel from '../views/AdminPanel.vue';
const routes = [
{
path: '/',
name: 'BattleRanking',
component: BattleRanking,
meta: { title: '百人大战排行榜' }
},
{
path: '/admin',
name: 'AdminPanel',
component: AdminPanel,
meta: { title: '管理员面板' }
},
{
// 捕获所有未匹配的路由,重定向到首页
path: '/:pathMatch(.*)*',
redirect: '/'
}
];
const router = createRouter({
history: createWebHistory(),
routes
});
// 全局前置守卫,设置页面标题
router.beforeEach((to, from, next) => {
// 设置文档标题
if (to.meta.title) {
document.title = to.meta.title;
}
next();
});
export default router;