浏览器报错:Uncaught TypeError: Cannot read property ‘trim‘ of undefined

简介: 浏览器报错:Uncaught TypeError: Cannot read property ‘trim‘ of undefined

今天在制作项目的时候这个trim报错了。

首先知道这个trim是应用于字符串的一个方法,所以这个时候就可能是数据里面有东西不是字符串。

经过排查发现有一个值为null,所以加一个三元表达式即可解决此问题

相关文章
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
320 0
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
472 0
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
487 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘username‘),粗心惹的祸,数据都不知道写呢了,
Cannot read properties of undefined (reading ‘username‘),粗心惹的祸,数据都不知道写呢了,
下一篇
开通oss服务