有可能是数据还没有加载出来,可使用是否为 undefined 进行判断:
for (var i=0,len1=medList.length; i<len1; i++) { var partList = [] // 判断数据是否加载完成 if (medList[i]) { for (var k=0,len2=medList[i].length; k<len2; k++) { for (var j=0,len3=allMed.length; j<len3; j++) { const index = allMed[j].value.indexOf(medList[i][k]) if (index >= 0) { partList.push(allMed[j]) } } } console.log(partList) cMedlist.push(partList) } }
标签:TypeError,undefined,read,Cannot,length,partList From: https://www.cnblogs.com/daxiangcai/p/16941117.html