From 59e1dc524b90cea2f06fdb05841e5b29b5646348 Mon Sep 17 00:00:00 2001 From: chutingting Date: Tue, 12 Dec 2023 18:48:00 +0800 Subject: [PATCH] edit title --- index.html | 2 +- src/router/index.ts | 6 ++++-- src/views/login/index.vue | 11 ++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index c884133..9e5009a 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - Metavatar-慧影 + Metavatar diff --git a/src/router/index.ts b/src/router/index.ts index 3601e29..386d28f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"; +import { createRouter, createWebHashHistory, RouteRecordRaw, useRoute } from "vue-router"; import { getCurrentInstance } from "vue"; export const Layout = () => import("@/layout/index.vue"); @@ -219,7 +219,9 @@ const router = createRouter({ // 2023-5-23 添加平滑滚动 YWQ scrollBehavior: () => ({ behavior: "smooth", left: 0, top: 0 }), }); - +router.beforeEach((to, from) => { + document.title = 'Metavatar-' + (to.query.p || from.query.p || localStorage.getItem("title") || '') +}) /** * 重置路由 */ diff --git a/src/views/login/index.vue b/src/views/login/index.vue index eaa0d2a..2553ee3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -19,7 +19,7 @@ >
{{ - $t("login.title") + " " + $t("login.login") + title + " " + $t("login.login") }}