From c21d397b99e3a106b1ec61e5a9162c4ea49681f3 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 26 Jun 2021 14:39:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20localizeText=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 21c124c..ba5bc33 100644 --- a/index.js +++ b/index.js @@ -286,13 +286,17 @@ module.exports = { } }, - setBarTitles({ windowTitle, pageTitle } = {}) { - let page = this.$store ? this : getCurrentPages()[getCurrentPages().length - 1] - uni.setNavigationBarTitle({ title: pageTitle || page.i18nText[page.$store.state.i18n.mylang].tPageTitle }) - // #ifdef H5 - document.title = windowTitle || page.$store.getters['i18n/getAppName'] // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。 - // #endif - if (page.$store._mutations['i18n/setTabbar']) page.$store.commit('i18n/setTabbar') // 必须要在有 tab 的页面里重置才有效果 + // setBarTitles({ windowTitle, pageTitle } = {}) { + // let page = this.$store ? this : getCurrentPages()[getCurrentPages().length - 1] + // uni.setNavigationBarTitle({ title: pageTitle || page.i18nText[page.$store.state.i18n.mylang].tPageTitle }) + // // #ifdef H5 + // document.title = windowTitle || page.$store.getters['i18n/getAppName'] // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。 + // // #endif + // if (page.$store._mutations['i18n/setTabbar']) page.$store.commit('i18n/setTabbar') // 必须要在有 tab 的页面里重置才有效果 + // }, + + localizeText(i18nText) { + return i18nText[this.$store.state.i18n.mylang] }, localeText() {