獲得陣列中對應欄位的一組資料
阿新 • • 發佈:2018-11-17
資料格式
reportList: [{
date:
""
,
projectCode: ""
,
hours: 4,
content:
""
,
status:
""
,
matterItem: [{
matterCode:
""
,
hours:
}]
}]
var idex = e.currentTarget.dataset.code; var reportList = this.data.reportList; for (var i = 0; i < reportList.length;i++){ if (reportList[i].matterItem) { for (var j = 0; j < reportList[i].matterItem.length;j++){ if (reportList[i].matterItem[j].matterCode == idex) { reportList[i].matterItem = reportList[i].matterItem[j]; var datas=reportList[i]; } } } }