From b85824400807775805fc6a5f739327cd122c36e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=20=E5=85=83=E5=B1=B1?= Date: Thu, 1 Feb 2024 11:20:41 +0800 Subject: [PATCH] f --- index.html | 25 ++++++++++++++----------- src/router/index.js | 9 +++++++-- 2 files changed, 21 insertions(+), 13 deletions(-) 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;