常见js报错

1Uncaught TypeError: Cannot read property 'length' of null 

Uncaught TypeError: Cannot read property 'length' of null

错误怎么处理?

1.可能是返回的datagrid数据格式有问题,比如{"total":0,"rows":null},改为{"total":0,"rows":"[]"}就可以了      //后台解决

if (capital != null && capital.length < 1) {}                                  //前端解决

Uncaught TypeError: Cannot read property 'length' of null

错误怎么处理?

1.可能是返回的datagrid数据格式有问题,比如{"total":0,"rows":null},改为{"total":0,"rows":"[]"}就可以了      //后台解决

if (capital != null && capital.length < 1) {}                                  //前端解决

猜你喜欢

转载自www.cnblogs.com/1439107348s/p/10609242.html