Compare commits
No commits in common. "dd7b04a7253d5285c9defaa47b13d3a04960be4c" and "431a09f8a53fa156a6b66a27e9ba843b0c3af119" have entirely different histories.
dd7b04a725
...
431a09f8a5
1 changed files with 0 additions and 21 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import HomeView from '../views/HomeView.vue'
|
import HomeView from '../views/HomeView.vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: [
|
routes: [
|
||||||
|
|
@ -10,9 +8,6 @@ const router = createRouter({
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'home',
|
name: 'home',
|
||||||
component: HomeView,
|
component: HomeView,
|
||||||
meta: {
|
|
||||||
title: '首页'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/about',
|
path: '/about',
|
||||||
|
|
@ -21,34 +16,18 @@ const router = createRouter({
|
||||||
// this generates a separate chunk (About.[hash].js) for this route
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
// which is lazy-loaded when the route is visited.
|
// which is lazy-loaded when the route is visited.
|
||||||
component: () => import('../views/AboutView.vue'),
|
component: () => import('../views/AboutView.vue'),
|
||||||
meta: {
|
|
||||||
title: '关于'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/practice',
|
path: '/practice',
|
||||||
name: 'Practice',
|
name: 'Practice',
|
||||||
component: () => import('../views/Practice.vue'),
|
component: () => import('../views/Practice.vue'),
|
||||||
meta: {
|
|
||||||
title: '单人练习'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/network-battle',
|
path: '/network-battle',
|
||||||
name: 'NetworkBattle',
|
name: 'NetworkBattle',
|
||||||
component: () => import('../views/NetworkBattle.vue'),
|
component: () => import('../views/NetworkBattle.vue'),
|
||||||
meta: {
|
|
||||||
title: '在线比赛'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
// 全局前置守卫:在每次导航前执行
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
// 从路由的meta中获取title,并设置给页面标题
|
|
||||||
document.title = to.meta.title ? `${to.meta.title} - ArithmaBattle` : 'ArithmaBattle'
|
|
||||||
next()
|
|
||||||
})
|
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue