feat: add titles for settings
This commit is contained in:
parent
9a167ee990
commit
377c015c91
11 changed files with 66 additions and 7 deletions
|
@ -2,11 +2,10 @@ import { pwaInfo } from 'virtual:pwa-info'
|
|||
import type { Link } from '@unhead/schema'
|
||||
import type { Directions } from 'vue-i18n-routing'
|
||||
import { buildInfo } from 'virtual:build-info'
|
||||
import { APP_NAME } from '~/constants'
|
||||
import type { LocaleObject } from '#i18n'
|
||||
|
||||
export function setupPageHeader() {
|
||||
const i18n = useI18n()
|
||||
const { locale, locales, t } = useI18n()
|
||||
|
||||
const link: Link[] = []
|
||||
|
||||
|
@ -30,19 +29,19 @@ export function setupPageHeader() {
|
|||
}
|
||||
}
|
||||
|
||||
const localeMap = (i18n.locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||
acc[l.code!] = l.dir ?? 'auto'
|
||||
return acc
|
||||
}, {} as Record<string, Directions>)
|
||||
|
||||
useHeadFixed({
|
||||
htmlAttrs: {
|
||||
lang: () => i18n.locale.value,
|
||||
dir: () => localeMap[i18n.locale.value] ?? 'auto',
|
||||
lang: () => locale.value,
|
||||
dir: () => localeMap[locale.value] ?? 'auto',
|
||||
},
|
||||
titleTemplate: (title) => {
|
||||
let titleTemplate = title ? `${title} | ` : ''
|
||||
titleTemplate += APP_NAME
|
||||
titleTemplate += t('app_name')
|
||||
if (buildInfo.env !== 'release')
|
||||
titleTemplate += ` (${buildInfo.env})`
|
||||
return titleTemplate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue