Skip to content

Commit

Permalink
feat: update locale hook
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranwong9865 committed Aug 10, 2024
1 parent 6d4e992 commit eadef3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/composables/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function useLocale() {

const title = useTitle()

const setLocaleTitle = (locale?: string, isKey: boolean = true) => {
const setLocaleTitle = (locale?: string, isKey: boolean = false) => {
const _t = isKey ? t(locale || 'app.title') : locale
title.value = _t === t('app.title') ? _t : `${_t} | ${t('app.title')}`
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/vue-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ router.beforeEach(() => {
router.afterEach((to) => {
const { setLocaleTitle } = useLocale()
if (to.meta.locale)
setLocaleTitle(to.meta.locale)
setLocaleTitle(to.meta.locale, true)
else if (to.meta.title)
setLocaleTitle(to.meta.title, false)
setLocaleTitle(to.meta.title)
else
setLocaleTitle()

Expand Down

0 comments on commit eadef3b

Please sign in to comment.