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 ''
  }
})

国际化其他配置项不变


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM