需要使用v-for循环数据 但是需要使用数据的key值数据结构是这样的{ "工艺检测项目": [{ "id": 5, "batchid": 1, "brandid": 66, "smallbrandid": 68, "criterionitemid": 9, "criterionitemname": "光泽", "criterionitemcontent": "5.0", "indicatorsid": 8, "indicatorsname": "光泽", "indicatorsvalue": "0", "processid": null, "ruleremark": null, "remark": null, "inputtype": true, "isokvalue": -2
}], "感官类项目": [{ "id": 6, "batchid": 1, "brandid": 66, "smallbrandid": 68, "criterionitemid": 10, "criterionitemcontent": "30.0", "indicatorsid": 7, "indicatorsvalue": "0", "processid": null, "ruleremark": null, "remark": null, "inputtype": true, "isokvalue": -2
}]
}循环是这样<Collapse style="margin-top:3%" v-for="(value,key) in technologyInfo">
<Panel>
key <span style="font-size:16px"></span>
<div slot="content">
<Collapse v-for="info in value">
<Panel style="font-size:14px">
{{info.criterionitemname}} <p slot="content">
<span style="display:flex;justify-content:space-between;width:100%">{{info.criterionitemname}}:<span>{{info.indicatorsvalue}}分</span></span>
</p>
</Panel>
</Collapse>
</div>
</Panel></Collapse>这样会报错
2 回答
慕少森
TA贡献2019条经验 获得超9个赞
let keysArray = Object.keys(technologyInfo)let technologyInfoList = [].concat(keysArray.map(t => ({key: t, value: technologyInfo[t]})))
<Collapse style="margin-top:3%" v-for="item in technologyInfoList" />
添加回答
举报
0/150
提交
取消