vue下页面报错解决1.Cannot read property 'temp' of null"

我的环境

  1. 电脑系统Ubuntu,vscode编辑器
  2. 项目是使用vue-cli搭建的脚手架,文件名后缀均为.vue
  3. 使用vuetify框架

vue从后台获取到数据并已渲染元素但还是报null错误

无论删除哪条报错的数据,处在第一条数据永远在报错在这里插入图片描述
源代码页面在这里插入图片描述
我的初始赋值的deviceLatestValue是null,初始渲染读取deviceLatestValue.temp当然是Cannot read property ‘temp’ of null",解决办法是,给deviceLatestValue初始赋值{},或者template模板里类似读取deviceLatestValue的父元素都加一个v-if=“deviceLatestValue != null”,完美解决
如下图:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/OnismYY/article/details/87199198