diff --git a/index.html b/index.html index 8388c4b..4863677 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,16 @@ - - - - - Vite + Vue - - -
- - - + + + + + + 延庆博物馆 + + + +
+ + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 2fdb0e2..25cc7ef 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,7 +3,7 @@ import { createRouter, createWebHistory } from 'vue-router'; const routes = [ { path: '/', - redirect: 'home' + redirect: 'home/navigation' }, { path: '/home', @@ -13,6 +13,7 @@ const routes = [ { path: 'navigation', name: 'navigation', + meta: { title: '首页' }, component: () => import('@/views/navigation/index.vue'), }, ] @@ -116,5 +117,9 @@ const router = createRouter({ history: createWebHistory(), routes }); - +router.beforeEach((to, from) => { + if (to.meta.title) { + document.title = to.meta.title + } +}) export default router;