fix: Document title
This commit is contained in:
+1
-1
@@ -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>Rustdesk-Api-Admin</title>
|
||||
<title>Rustdesk API Admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||
const whiteList = ['/login', '/register']
|
||||
const routeStore = useRouteStore(pinia)
|
||||
const appStore = useAppStore(pinia)
|
||||
appStore.getAdminConfig()
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
|
||||
document.title = T(to.meta?.title) + ' - ' + appStore.setting.title
|
||||
|
||||
+8
-4
@@ -23,7 +23,7 @@ export const useAppStore = defineStore({
|
||||
id: 'App',
|
||||
state: () => ({
|
||||
setting: {
|
||||
title: 'Rustdesk-Api-Admin',
|
||||
title: 'Rustdesk API Admin',
|
||||
hello: '',
|
||||
sideIsCollapse: false,
|
||||
logo,
|
||||
@@ -55,17 +55,21 @@ export const useAppStore = defineStore({
|
||||
},
|
||||
getAppConfig () {
|
||||
console.log('getAppConfig')
|
||||
app().then(res => {
|
||||
return app().then(res => {
|
||||
this.setting.appConfig = res.data
|
||||
})
|
||||
},
|
||||
getAdminConfig () {
|
||||
console.log('getAdminConfig')
|
||||
admin().then(res => {
|
||||
this.setting.title = res.data.title
|
||||
return admin().then(res => {
|
||||
this.replaceAdminTitle(res.data.title)
|
||||
this.setting.hello = res.data.hello
|
||||
})
|
||||
},
|
||||
replaceAdminTitle(newTitle){
|
||||
document.title = document.title.replace(`- ${this.setting.title}`, `- ${newTitle}`)
|
||||
this.setting.title = newTitle
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user