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

国际化其他配置项不变

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

原文地址:https://www.cnblogs.com/smart-girl/p/11084010.html

时间: 2024-07-29 19:57:43

vue 报错解决:TypeError: Cannot read property '_t' of undefined"的相关文章

当使用npm run build的时候报错:TypeError: Cannot read property 'thisCompilation' of undefined

最近接手公司前端外包出去的的项目,然后在npm run build的时候遇到了两个问题. 第一点是  A complete log of this run can be found in:npm ERR!     C:\Users\90422\AppData\Roaming\npm-cache\_logs\2018-04-28T09_26_42_435Z-debug.log 这个问题很简单,主要是npm自己报错了,更新npm 即可.(奇怪的只是这个项目需要这样,其他项目并没有这个问题,所以还需要

easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined

1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问题,然后从早上干到下午,网上各种方法用尽了就是不行! 最后发现规律了: 使用mybatis从数据库查询返回的List不报错,但是自己new的ArrayList总是报错! 后来发现原来mybatis返回的不是ArrayList!而是PageList! 3.解决问题 PageList中有个参数Pagin

jQuery mobile报错 Uncaught TypeError: Cannot read property 'concat' of undefined

写一个jQuery mobile的demo <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="styl

ueditor禁用编辑的时候报错:Uncaught TypeError: Cannot read property &#39;contentEditable&#39; of undefined

解决方案 报错的代码片段↓ //初始化编辑器 var conEditor = UE.getEditor('id_Test'); //编辑器.禁用 conEditor.setDisabled(); 修复后代码片段↓ //初始化编辑器 var conEditor = UE.getEditor('id_Test'); //对编辑器的操作最好在编辑器ready之后再做 conEditor.ready(function () { //编辑器.禁用 conEditor.setDisabled(); }) u

vue报错 Uncaught TypeError: Cannot read property ‘children ’ of null

Uncaught TypeError: Cannot read property 'children ' of null ratings未渲染完毕,就跳走goods了,取消默认跳转,即可

Uncaught TypeError: Cannot read property &#39;msie&#39; of undefined

Uncaught TypeError: Cannot read property 'msie' of undefined 因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed'; ”报了Uncaught TypeError: Cannot read property 'msie' of undefined的错误.

VUE.JS 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property &#39;xxxx&#39; of undefined 的解决办法

正常情况下在data里面都有做了定义 在函数里面进行赋值 这时候你运行时会发现,数据可以请求到,但是会报错 TypeError: Cannot set property 'listgroup' of undefined 主要原因是: 在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定.可以看下 Stackoverflow 的解释: 解决办法: 1.用ES6箭头函数,箭头方法可以和父方法共享变量 2.在请求axios外面定义一下 var that=this 问题

VUE - 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property &#39;xxxx&#39; of undefined 的解决办法

created() { var that=this axios.get('http://jsonplaceholder.typicode.com/todos') .then(function (res) { // handle success // console.log(res); that.todos = res.data }) .catch(function (error) { // handle error console.log(error); }) .finally(function

Vue报错:Uncaught TypeError: Cannot assign to read only property &#39;exports&#39; of object 的解决方法

问题是这样的:如下>> 解决办法: 1“:我的webpack 最高版本,造成 混用import和module.exports :所以降低webpack版本 安装指定版本:npm install [email protected] -g 例如:npm install [email protected] -g 删除 编译目录文件: 2重新生成 然后输入启动命令: 成功解决!效果: 方法二: 注释掉后一个 重新生成,启动项目 OK! Vue报错:Uncaught TypeError: Cannot