diff --git a/index.js b/index.js index fb16893..8fafdfc 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ module.exports = { localizeText(i18nText) { // 如果直接挂载到 Vue.prototype 下,那么可以直接访问 this.i18nText。但如果通过 this.$T.localeText 访问,那么 this.i18nText 就报错了。因此安全起见,先获取当前 page - const thisPage = this.thisPage() + const thisPage = thisPage() if (i18nText && typeof(i18nText)==='object' && thisPage.$store?.state?.i18n?.mylang) { return i18nText[thisPage.$store.state.i18n.mylang] || '' } @@ -53,7 +53,7 @@ module.exports = { }, localeText() { - const thisPage = this.thisPage() // 如果直接挂载到 Vue.prototype 下,那么可以直接访问 this.i18nText。但如果通过 this.$T.localeText 访问,那么 this.i18nText 就报错了。因此安全起见,先获取当前 page + const thisPage = thisPage() // 如果直接挂载到 Vue.prototype 下,那么可以直接访问 this.i18nText。但如果通过 this.$T.localeText 访问,那么 this.i18nText 就报错了。因此安全起见,先获取当前 page return thisPage.i18nText[thisPage.$store.state.i18n.mylang] }, @@ -381,7 +381,7 @@ module.exports = { }) */ showToast({ tool, type, image, title, duration = 2000, ...rest }) { - let pageNow = this.thisPage() + const pageNow = thisPage() if (tool === 'uni' || !(pageNow.$refs && pageNow.$refs.toast)) { // #ifdef APP-PLUS uni.showToast({ icon: 'none', title, duration, ...rest })