第一是后端返回的数据: 需要处理成第二info的数据进行对应显示
- let obj = {
- id: 4,
- name: "水水",
- Models: [
- {
- tip: "小样",
- peak: "小王",
- tipList: ["01", "02"], //小样
- peakList: ["03", "04"], //小王
- },
- {
- tip: "小李",
- peak: "小峰",
- tipList: ["01", "02"], //小李
- peakList: ["03", "04"], //小峰
- },
- ],
- };
复制代码
我需要处理成:
- let info = {
- id: 4,
- name: "水水",
- Models: [
- {
- dataTable:[
- {
- name: tip,//小样
- dayTime:tipList //["01", "02"]
- },{
- name: peak,//小王
- dayTime:peakList //["03", "04"]
- }
- ]
- },
- {
- dataTable:[
- {
- name: tip,//小李
- dayTime:tipList //["01", "02"]
- },{
- name: peak,//小峰
- dayTime:peakList //["03", "04"]
- }
- ]
- },
- ],
- };
复制代码 |