forked from AkkomaGang/admin-fe
perf[i18n]: refine generateTitle function
This commit is contained in:
parent
d18902dfee
commit
2472107768
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,10 @@
|
||||||
// translate router.meta.title, be used in breadcrumb sidebar tagsview
|
// translate router.meta.title, be used in breadcrumb sidebar tagsview
|
||||||
export function generateTitle(title) {
|
export function generateTitle(title) {
|
||||||
return this.$t('route.' + title) // $t :this method from vue-i18n, inject in @/lang/index.js
|
const hasKey = this.$te('route.' + title)
|
||||||
|
const translatedTitle = this.$t('route.' + title) // $t :this method from vue-i18n, inject in @/lang/index.js
|
||||||
|
|
||||||
|
if (hasKey) {
|
||||||
|
return translatedTitle
|
||||||
|
}
|
||||||
|
return title
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue