类似于#Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length‘)
类似于#Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length‘)
报错显示某一属性在某一数组或对象中不存在,首先你先确定这个属性是否真的存在,如果确实不存在则不用或是寻找原因。
然后再寻找这一数组或是对象是否存在,如果不存在寻找原因。存在的话就判断是什么时候开始存在的,是不是在请求的数据还没有拿到,你就开始使用了呢?
如果当你页面第一次渲染时出现这个错误而之后没有出现,那就说明当你拿着这个数据渲染页面时,该数据并没有拿到,当等了一段时间后数据拿到了,所以不再增加提示,但是之前的错误提示还存在,所以这个是需要更改一下页面渲染的时机,或是在方法后面加上||[]、||{}避免出现null和undefind的错误。
方法:
1、给父节点使用v-if设置渲染条件,如果某一属性为undefind则不渲染。
2、用if或&&判断数据是否返回,再使用。
3、将该数据的数据结构在data中写下来。
4、如果报错的是该对象或数组身上的某一方法,则在其后面添加||[]、||{}。
类似于#Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length‘)相关推荐
- vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘)
在查看信息时,界面没反应,然后查看控制台报错 index.vue?t=1680763420735:497 Uncaught (in promise) TypeError: Cannot read pr ...
- vue发送请求时遇到Uncaught (in promise) TypeError Cannot read properties of undefined(reading ‘randomExtend
最近在项目中遇到一个前端问题Uncaught (in promise) TypeError: Cannot read properties of undefined(reading 'randomEx ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘protocol‘)
问题原因,main.js中引用axios区别: import axios from "axios";Vue.use(axios); 正确写法: import axios from ...
- vue3 Uncaught (in promise) TypeError: Cannot read properties of undefined 其实是解构赋值的问题
先看张图,好生奇怪,使用了v-for循环之后突然报错了. 在vue3中当我们用到了解构赋值配合reactive toRefs 方式渲染页面时,报错Uncaught (in promise) TypeE ...
- Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin
只要在后面加上.catch((e) => {}),就不会报错了, const queGetdata = (params, context) => {return new Promise(( ...
- vue发送请求时遇到index.vue6ced90 Uncaught (in promise) TypeError Cannot read properties of undefined
项目中遇到问题如下: 查阅资料得知: 发请求的时候用的是异步模式,即使promise立刻被处理返回,但是浏览器在开始加载对象的时候,这个对象还是没有定义,所以也就读不到返回的值属性. 将原来的函数改为 ...
- vue发送请求时遇到index.vue?6ced:90 Uncaught (in promise) TypeError: Cannot read properties of undefined
项目中遇到问题如下: 查阅资料得知: 发请求的时候用的是异步模式,即使promise立刻被处理返回,但是浏览器在开始加载对象的时候,这个对象还是没有定义,所以也就读不到返回的值属性. 将原来的函数改为 ...
- web前端Vue 报错:Uncaught (in promise) TypeError: Cannot read properties of nu
前言 最近在写vue项目 在写自定义分页器的时候报了一个异常 知道错误却一直找不到解决方案 苦思冥想后 还是js的基础语法不扎实导致的,在此记录一下解决方案和思路 为以后的bug解决之路打下基础 错误 ...
- 报错,Uncaught TypeError: Cannot read properties of undefined (reading ‘inputValue‘) at <anonymous>
错误: Uncaught TypeError: Cannot read properties of undefined (reading 'inputValue') at <anonym ...
最新文章
- 网络推广营销浅析网站在优化中流量突然减少了是为什么?
- 2021-01-26 粒子群优化算法(PSO)以及Matlab实现
- sudo: apt-get:找不到命令_Linux重复执行历史命令方法详解
- 华住数据库_华住内控人系列故事(四)技术领先篇——搭建大数据风险数据仓,实现自助取数...
- 【图像分割】基于matlab GUI阙值+边缘检测+区域法图像分割【含Matlab源码 817期】
- linux中swap的权限,有关 Linux Swap
- “冲击波”病毒的症状和解决方案
- tensorflow keras 构建神经网络、Alex net、VGG、CNN网络
- onenote2016下载地址
- 管理大师德鲁克60句经典名言
- AE开发之主窗体通过Base Comand和IHookHelper接口向子窗体转递图层信息方法模板
- 同一个实验室,硕士们进了大厂拿高薪,为什么博士却要挤破头进高校?
- iOS开发人员必看的精品资料(100个)(转)
- SQL中的笛卡尔你真的懂吗?
- 或许你就是那个背锅侠【多图】
- 深入了解passive-interface
- 2017中山大学计算机考研科目,2017年中山大学0812计算机科学与技术考研参考书目推荐...
- React 面试题汇总(一)!!!
- piv图像处理文献综述_体视2D-3cPIV相机标定方法研究
- Debezium系列之:使用Debezium接入SQL Server数据库数据到Kafka集群的详细技术文档