图一(错误)
Vue 动态更新数据 页面不渲染
图一(正确)
Vue 动态更新数据 页面不渲染
动态赋值的时候一定要注意数据类型.不然又容易踩坑了

数据动态赋值
this.deviceInfo[0].forEach(item => {
item.AttenDevice.A = {
showContent: false,
A: item.AttenDevice
};
item.CarMonitorDevice = {
showContent: false,
A: item.CarMonitorDevice
};
item.EnviDevice = {
showContent: false,
A: item.EnviDevice
};
item.MonitorDevice = {
showContent: false,
A: item.MonitorDevice
};
item.TowerDevice = {
showContent: false,
A: item.TowerDevice
};
});

动态更新方法
this.$set(this.deviceInfo[0].A,‘showContent’,true)
this.deviceInfo[0].A:修改的对象
showContent:修改对象的属性
true:修改对象的属性值

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2023-03-24
  • 2021-05-09
  • 2022-12-23
猜你喜欢
  • 2021-06-20
  • 2022-12-23
  • 2021-12-29
  • 2021-09-18
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
相关资源
相似解决方案