fix: Document title

This commit is contained in:
lejianwen
2025-02-12 21:08:33 +08:00
parent 8617959d15
commit aeafcdde60
3 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rustdesk-Api-Admin</title> <title>Rustdesk API Admin</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
+1
View File
@@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/register'] const whiteList = ['/login', '/register']
const routeStore = useRouteStore(pinia) const routeStore = useRouteStore(pinia)
const appStore = useAppStore(pinia) const appStore = useAppStore(pinia)
appStore.getAdminConfig()
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
document.title = T(to.meta?.title) + ' - ' + appStore.setting.title document.title = T(to.meta?.title) + ' - ' + appStore.setting.title
+8 -4
View File
@@ -23,7 +23,7 @@ export const useAppStore = defineStore({
id: 'App', id: 'App',
state: () => ({ state: () => ({
setting: { setting: {
title: 'Rustdesk-Api-Admin', title: 'Rustdesk API Admin',
hello: '', hello: '',
sideIsCollapse: false, sideIsCollapse: false,
logo, logo,
@@ -55,17 +55,21 @@ export const useAppStore = defineStore({
}, },
getAppConfig () { getAppConfig () {
console.log('getAppConfig') console.log('getAppConfig')
app().then(res => { return app().then(res => {
this.setting.appConfig = res.data this.setting.appConfig = res.data
}) })
}, },
getAdminConfig () { getAdminConfig () {
console.log('getAdminConfig') console.log('getAdminConfig')
admin().then(res => { return admin().then(res => {
this.setting.title = res.data.title this.replaceAdminTitle(res.data.title)
this.setting.hello = res.data.hello this.setting.hello = res.data.hello
}) })
}, },
replaceAdminTitle(newTitle){
document.title = document.title.replace(`- ${this.setting.title}`, `- ${newTitle}`)
this.setting.title = newTitle
},
}, },
}) })