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

前端报错如下:
[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 ''
  }
})

国际化其他配置项不变

猜你喜欢

转载自www.cnblogs.com/smart-girl/p/11084010.html