[渲染层错误] SystemError (exparserScriptError)
Cannot read property 'forEach' of null
TypeError: Cannot read property 'forEach' of null
at Module.x (http://127.0.0.1:63974/__pageframe__/__dev__/WAWebview.js?t=wechat&v=2.12.2&s=1599698224023:2:1706201)
at http://127.0.0.1:63974/__pageframe__/__dev__/WAWebview.js?t=wechat&v=2.12.2&s=1599698224023:2:161809
at http://127.0.0.1:63974/__pageframe__/__dev__/WAWebview.js?t=wechat&v=2.12.2&s=1599698224023:2:128237
at e.
at http://127.0.0.1:63974/__pageframe__/__dev__/jsdebug.js:1:13816
at i (http://127.0.0.1:63974/__pageframe__/__dev__/jsdebug.js:1:13823)
网友回复
循环之前先判断一下
if(list.length){
list.forEach(item=>{})
}
打个debugger吧,应该是你要foreach的数据有问题
forEach之前判断一下类型
打印下你前面的数组,看看有没有值
建议用短路写法