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