lrf 2 years ago
parent
commit
9e9d69e624
2 changed files with 5 additions and 2 deletions
  1. 1 1
      index.html
  2. 4 1
      src/router/index.ts

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <link rel="icon" href="/favicon.ico">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Vite App</title>
+    <title>Loading...</title>
   </head>
   <body>
     <div id="app"></div>

+ 4 - 1
src/router/index.ts

@@ -1,7 +1,7 @@
 import { createRouter, createWebHistory } from 'vue-router';
 
 const router = createRouter({
-  history: createWebHistory(import.meta.env.BASE_URL),
+  history: createWebHistory(import.meta.env.VITE_BASE_URL),
   routes: [
     {
       path: '/',
@@ -17,5 +17,8 @@ const router = createRouter({
     },
   ],
 });
+router.beforeEach((to, form) => {
+  window.document.title = to.meta.title as string;
+});
 
 export default router;