已知数据vartableData=[{val:"红",val1:"大",val2:"五边形",val3:"1*222"},{val:"绿",val1:"大",val2:"6边形",val3:"1*2224"},{val:"红",val1:"大",val2:"五边形",val3:"1*222"}]预期结果varresult=[['红','绿'],['大'],['五边形','6边形'],["1*222","1*222"]]目前做法varcc=[]tableData.map((item,index)=>{console.log(item,index)vararr=[]varobj={}for(varkeyinitem){if(key!=='price'){obj[key]=item[key]arr.push(obj[key])console.log(arr)}console.log(key,item[key])}cc.push(arr)})console.log(cc)vardd=[];for(vari=0;ivarkk=[]; console.log(cc[i])for(varj=0;jkk.push(cc[i][j]) }console.log(kk)dd.push(kk)}console.log(dd)没有思路了
繁星点点滴滴
慕勒3428872
相关分类