vux
vux copied to clipboard
[vue-i18n] Fall back to translate the keypath 'depo.method' with 'en-US' locale.
trafficstars
[vue-i18n] Fall back to translate the keypath 'depo.method' with 'en-US' locale.
locale zh-CN

const i18n = new VueI18n({ locale: cookie.get('lang'), messages: { 'zh-CN': require('./common/lang/cn'), // 中文语言包 'en-US': require('./common/lang/en') // 英文语言包 } })
mounted () {
if (cookie.get('lang') === '0') {
this.locale = 'en-US'
this.lang = '中文'
} else {
this.locale = 'zh-CN'
this.lang = 'ENG'
}
cookie.set('lang', this.locale === 'en-US' ? '0' : '1', 1)
},
watch: {
locale (val) {
this.$i18n.locale = val
console.log('locale', val)
}
},

本地有cookie, 为1,函数是 lang=1的时候,locale是中文,但是它还是返回到用英文。
你好,请问解决了吗