weex中使用vue-i18n,在网页端能正常使用,在android上报 'this.$t' is undefined

新手上路,请多包涵
import VueI18n from 'vue-i18n'
import Vue from 'vue'

Vue.use(VueI18n)

const messages = {
    en: require('../common/lang/en'),
}

const i18n = new VueI18n({
    locale: 'en',
    messages
})

export default {
    data() {
        return {
            hello: this.$t('hello'),
        }
    },

    i18n,
}

weex中使用vue-i18n进行多语言功能开发代码,测试时在网页上能正常显示,但是集成在android端时报以下错误,
reportJSException >>>> instanceId:28, exception function:createInstance, exception:Exception: TypeError: this.$t is not a function. (In 'this.$t('hello')', 'this.$t' is undefined)

谁知道怎么解决吗?

阅读 6.1k
2 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题