错误页面:

项目中遇到Cannot read property 'length' of null

本人遇到的这个错误的原因主要是后台返回给页面的数据错误,没有数据时我返回给前台页面的是null,所以这个时候前台就会报这个Cannot read property ‘length’ of null的错误提示,当没有数据时正确的返回格式应该是一个空集合,这样才不会报错。

修改前的后台代码(报错):

项目中遇到Cannot read property 'length' of null

接口回调结果:

项目中遇到Cannot read property 'length' of null

修改后的后台代码(正确):

项目中遇到Cannot read property 'length' of null

接口回调结果:

项目中遇到Cannot read property 'length' of null

相关文章:

  • 2021-09-10
  • 2021-09-30
  • 2021-08-11
  • 2021-07-17
  • 2021-08-16
  • 2021-10-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2021-12-26
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案