From 1571b5e2b9f405a7cb63d552d6dd0c901a59bc50 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Fri, 10 Jan 2025 16:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 3 ++- src/hooks/web/useTitle.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index c0a68ec73..531256c97 100644 --- a/index.html +++ b/index.html @@ -148,7 +148,7 @@ document.getElementById('app-loading-title').innerHTML = systemConfig.projectName function replaceFavicon(src) { var link = document.querySelector("link[rel~='icon']"); - if (!link) { + if (!link){ link = document.createElement('link'); link.rel = 'icon'; document.getElementsByTagName('head')[0].appendChild(link); @@ -156,6 +156,7 @@ link.href = src; } replaceFavicon(systemConfig.iconUrl); + document.title = systemConfig.projectName; diff --git a/src/hooks/web/useTitle.ts b/src/hooks/web/useTitle.ts index e531855ec..70fe0f14d 100644 --- a/src/hooks/web/useTitle.ts +++ b/src/hooks/web/useTitle.ts @@ -1,6 +1,7 @@ import { watch, ref } from 'vue' import { isString } from '@/utils/is' import { useAppStoreWithOut } from '@/store/modules/app' +import { getProjectName } from '@/utils/systemParam' const { t } = useI18n() // 国际化 const appStore = useAppStoreWithOut() @@ -15,7 +16,7 @@ export const useTitle = (newTitle?: string) => { title, (n, o) => { if (isString(n) && n !== o && document) { - document.title = n.replace(import.meta.env.VITE_APP_TITLE,t(`ts.${import.meta.env.VITE_APP_TITLE}`)) + document.title = n.replace(import.meta.env.VITE_APP_TITLE, t(`ts.${getProjectName()}`)) } }, { immediate: true }