vue 报错解决:TypeError: Cannot read property '_t' of undefined"

发布时间:2024-01-04 08:32:49

前端报错如下:
[Vue warn]: Error in render: “TypeError: Cannot read property ‘_t’ of undefined”

是在项目中用了多语言配置,vue 跟 i18n之间的兼容问题。解决方法如下:

    Vue.use(iView) 

替换成

Vue.use(iView, {
  i18n: function(path, options) {
    let value = i18n.t(path, options)
    if (value !== null && value !== undefined) {
      return value
    }
    return ''
  }
})

国际化其他项配置不变,仅作记录。

参考文章:
https://github.com/iview/iview/issues/1090

文章来源:https://blog.csdn.net/baixue6269/article/details/79537406
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。