vue中使用echarts从后端获取数据并显示到页面上

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

2.将echarts图里面的数据在请求数据的方法里for循环赋值出来

3.调用echarts获取图的方法

4.将for循环出来的数组传给图的方法里

5.实现了动态请求数据

你可能感兴趣的:(echarts,vue.js,javascript)