问题

for循环一直报错  Cannot read property 'total' of undefined,total在起初是有定义。

原因

是i<=的问题,改为<不报错了。infoArea长度为2,也就是i 应该循环2次。但是写成<=后,i 取值依次是:0,1,2,取值为2时,找不到对应的元素。

infoArea: [
     { title: '打印1', colorType: '彩色双面', count: 2, pages: 20, total: 40 },
     { title: '打印2', colorType: '黑白单面', count: 3, pages: 10, total: 30 }
]

小程序 for循环 报错 Cannot read property 'total' of undefined

 

相关文章:

  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-09-07
  • 2021-08-22
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案