添加 localizeText 方法

This commit is contained in:
陆柯 2021-06-26 14:39:05 +08:00
parent fae8ba0c75
commit c21d397b99

View File

@ -286,13 +286,17 @@ module.exports = {
} }
}, },
setBarTitles({ windowTitle, pageTitle } = {}) { // setBarTitles({ windowTitle, pageTitle } = {}) {
let page = this.$store ? this : getCurrentPages()[getCurrentPages().length - 1] // let page = this.$store ? this : getCurrentPages()[getCurrentPages().length - 1]
uni.setNavigationBarTitle({ title: pageTitle || page.i18nText[page.$store.state.i18n.mylang].tPageTitle }) // uni.setNavigationBarTitle({ title: pageTitle || page.i18nText[page.$store.state.i18n.mylang].tPageTitle })
// #ifdef H5 // // #ifdef H5
document.title = windowTitle || page.$store.getters['i18n/getAppName'] // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。 // document.title = windowTitle || page.$store.getters['i18n/getAppName'] // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。
// #endif // // #endif
if (page.$store._mutations['i18n/setTabbar']) page.$store.commit('i18n/setTabbar') // 必须要在有 tab 的页面里重置才有效果 // if (page.$store._mutations['i18n/setTabbar']) page.$store.commit('i18n/setTabbar') // 必须要在有 tab 的页面里重置才有效果
// },
localizeText(i18nText) {
return i18nText[this.$store.state.i18n.mylang]
}, },
localeText() { localeText() {