已知数组如下:

currentGood:[{name:'Da',ids:'aaa',pp:'123'},{name:'Cc',ids:'bbb',pp:'456'},{name:'Vv',ids:'ccc',pp:'789'}]

设置另一数组为modeDetail[]

      for (let i=0;i<this.currentGood.length;i++){
        let modelItem={};
        modelItem["id"]=this.currentGood[i].ids;
        modelItem["name"]=this.currentGood[i].name;
        modelItem["tele"]=this.currentGood[i].pp;
        modeDetail[i]=modelItem;
      }
      console.log(modeDetail);

运行调试结果如下

作用就是把已知的数据,重新挑选 

Logo

前往低代码交流专区

更多推荐