Quellcode durchsuchen

设置各页面title

wzl vor 2 Jahren
Ursprung
Commit
572e5515b2
2 geänderte Dateien mit 36 neuen und 11 gelöschten Zeilen
  1. 1 1
      public/index.html
  2. 35 10
      src/router/index.ts

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,maximum-scale=1,minimum-scale=1">
     <link rel="icon" href="/favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <title>ComPDFKit API for Developers</title>
   </head>
   <body>
     <noscript>

+ 35 - 10
src/router/index.ts

@@ -21,17 +21,26 @@ const routes: Array<RouteConfig> = [
   {
     path: '/dashboard',
     name: 'home',
-    component: dashboard
+    component: dashboard,
+    meta: {
+      title: 'Dashboard | ComPDFKit API for Developers'
+    }
   },
   {
     path: '/login',
     name: 'login',
-    component: login
+    component: login,
+    meta: {
+      title: 'Login in to ComPDFKit API for Developers'
+    }
   },
   {
     path: '/user/password',
     name: 'security',
-    component: security
+    component: security,
+    meta: {
+      title: 'Security | ComPDFKit API for Developers'
+    }
   },
   {
     path: '/api/keys',
@@ -43,7 +52,8 @@ const routes: Array<RouteConfig> = [
         name: 'addApiKeys',
         component: addApiKeys,
         meta: {
-          showfather: false
+          showfather: false,
+          title: 'API Keys | ComPDFKit API for Developers'
         }
       },
       {
@@ -51,12 +61,14 @@ const routes: Array<RouteConfig> = [
         name: 'editApiKeys',
         component: editApiKeys,
         meta: {
-          showfather: false
+          showfather: false,
+          title: 'API Keys | ComPDFKit API for Developers'
         }
       }
     ],
     meta: {
-      showfather: true
+      showfather: true,
+      title: 'API Keys | ComPDFKit API for Developers'
     }
   },
   {
@@ -69,7 +81,8 @@ const routes: Array<RouteConfig> = [
         name: 'addWebhook',
         component: addWebhook,
         meta: {
-          showfather: false
+          showfather: false,
+          title: 'Webhooks | ComPDFKit API for Developers'
         }
       },
       {
@@ -77,18 +90,23 @@ const routes: Array<RouteConfig> = [
         name: 'editWebhook',
         component: editWebhook,
         meta: {
-          showfather: false
+          showfather: false,
+          title: 'Webhooks | ComPDFKit API for Developers'
         }
       }
     ],
     meta: {
-      showfather: true
+      showfather: true,
+      title: 'Webhooks | ComPDFKit API for Developers'
     }
   },
   {
     path: '/billing/plan',
     name: 'plan',
-    component: plan
+    component: plan,
+    meta: {
+      title: 'Plan | ComPDFKit API for Developers'
+    }
   }
 ]
 
@@ -115,4 +133,11 @@ router.beforeEach((to, from, next) => {
   }
 })
 
+// 设置title
+router.afterEach(to => {
+  if (to && to.meta && to.meta.title) {
+    document.title = to.meta.title
+  }
+})
+
 export default router