add set tagsview title demo (#1167)

This commit is contained in:
花裤衩
2018-10-09 14:10:43 +08:00
committed by GitHub
parent ae2754a568
commit b0bd91cd0f
2 changed files with 14 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
// translate router.meta.title, be used in breadcrumb sidebar tagsview
export function generateTitle(title) {
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) {
// $t :this method from vue-i18n, inject in @/lang/index.js
const translatedTitle = this.$t('route.' + title)
return translatedTitle
}
return title