u
This commit is contained in:
		
							parent
							
								
									9b8acc3edf
								
							
						
					
					
						commit
						9e2cff1227
					
				
							
								
								
									
										5
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								index.js
									
									
									
									
									
								
							@ -40,7 +40,8 @@ module.exports = {
 | 
			
		||||
 | 
			
		||||
  localizeText(i18nText) {
 | 
			
		||||
    // 如果直接挂载到 Vue.prototype 下,那么可以直接访问 this.i18nText。但如果通过 this.$T.localeText 访问,那么 this.i18nText 就报错了。因此安全起见,先获取当前 page
 | 
			
		||||
    const thisPage = getCurrentPages()[getCurrentPages().length - 1]
 | 
			
		||||
    const thisPage = this.$store ? this // 对于组件内定义的 i18nText,要使用 this 而不是 getCurrentPages[...] 去访问。
 | 
			
		||||
      : getCurrentPages()[getCurrentPages().length - 1]
 | 
			
		||||
    if (i18nText && typeof(i18nText)==='object' && thisPage.$store?.state?.i18n?.mylang) {
 | 
			
		||||
      return i18nText[thisPage.$store.state.i18n.mylang] || ''
 | 
			
		||||
    }
 | 
			
		||||
@ -54,7 +55,7 @@ module.exports = {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  localeText() {
 | 
			
		||||
    let thisPage = this.$store ? this // 对于组件内定义的 i18nText,要使用 this 而不是 getCurrentPages[...] 去访问。
 | 
			
		||||
    const thisPage = this.$store ? this // 对于组件内定义的 i18nText,要使用 this 而不是 getCurrentPages[...] 去访问。
 | 
			
		||||
      : getCurrentPages()[getCurrentPages().length - 1] // 如果直接挂载到 Vue.prototype 下,那么可以直接访问 this.i18nText。但如果通过 this.$T.localeText 访问,那么 this.i18nText 就报错了。因此安全起见,先获取当前 page
 | 
			
		||||
    return thisPage.i18nText[thisPage.$store.state.i18n.mylang]
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user