1.请求数据
dataInfo().then(res => {
this.listData = res.zslVO;
this.listData2 = res.slVOList;
this.listData8 = res.damageRatioAnalysisVOList,
console.log(flmccode)
let arr = []
//for循环赋值
for (let i = 0; i < res.slVOList.length; i++) {
arr.push({ value: res.slVOList[i].sl, name: res.slVOList[i].flmc })
}
this.drawLine(arr)
let arr1 = {
name:[],
value:[],
value2:[],
}
for(let i=0;i<res.damageRatioAnalysisVOList.length;i++){
arr1.name.push(res.damageRatioAnalysisVOList[i].flmc)
arr1.value.push(res.damageRatioAnalysisVOList[i].sl)
}
this.drawLine2(arr1)
});
2.将echarts图里面的数据在请求数据的方法里for循环赋值出来
3.调用echarts获取图的方法
4.将for循环出来的数组传给图的方法里
5.实现了动态请求数据