js遍历数组,微信小程序数组的遍历,forEach

json数据返回的数组形式的,怎么遍历

js遍历数组,微信小程序数组的遍历,forEach

js遍历数组,微信小程序数组的遍历,forEach

js遍历数组,微信小程序数组的遍历,forEach

forEach处理:

 let commonProblemList = that.data.commonProblemList; //wxml里的对应的遍历的自定义的数组名,wx:for那个
    common.myRequest({
      url: 'queryNormalIssueTag',
      data: {},
      success(res) {
        console.log(res)
        let pageData = res.data.pageData;
        that.setData({
          commonProblemList: pageData
        })
        if (res.data.res.resultCode == '10041'){
          pageData.forEach(function(item, index){
            console.log(item); //这里的item就是从数组里拿出来的每一个每一组
            that.setData({
              id: item.id,
              title: item.title
            })
          })
        }
      }
    })

tips:pageData.forEach(function(item, index){console.log(item);})