vue向对象字段中加数组

一、对象完成后的类型展示

parmes = {
detailDatas:[
  {
    name: '456',
    gender: 1,
    idnum: '110101199003078670',
    address: '山东省xx市',
    cgoods_ids: 'dee4aa0a0d71467cb082cbca',
    valid_startdate: '',
    igoods_ids: '    123456',
    insurance_only: 0,
    insurance_state: 0
  },
  {
    name: '123',
    gender: 1,
    idnum: '37172519960605678965',
    address: '山东省xx市',
    cgoods_ids: 'dee4aa0a0d71467cb082cbca',
    valid_startdate: '',
    igoods_ids: '    123456',
    insurance_only: 0,
    insurance_state: 0
  }
],
orderTotalPrice: 0.01,
}

二、代码

const detailDatas = [];
for (let i = 0; i < cardInfoList.length; i++) {
   const cardInfo = cardInfoList[i];
   const temp = {
          name: cardInfo.name,
          // gender: '',
          idnum: cardInfo.idnum,
          address: '',
          cgoods_ids: cardInfo.cgoods_ids,
          valid_startdate: cardInfo.valid_startdate,
          igoods_ids: '123456',
          insurance_only: 0,
          insurance_state: 0,
        };
    detailDatas.push(temp);
   }
  const parmes = {
    detailData: JSON.stringify(detailDatas),
    orderTotalPrice: this.priceSummaryObj.priceTotal,
  };

 

posted @ 2019-08-23 16:16  碧果果  阅读(11653)  评论(0编辑  收藏  举报