挂上dataY时可以显示出折线图,tems则不行,其中tems和dataY数据格式是相同的。分析importMheaderfrom'../base/Mheader.vue'importechartsfrom'echarts'import{getHum,getTem,getAlldata,getIllsum}from'../api'exportdefault{data(){return{tems:[],hums:[],illsums:[],dataY:["5","10","15","30","14"]}},props:{height:{type:String,'default':'300px'},width:{type:String,'default':"100%"}},mounted(){this.draw();},created(){this.getTems();this.getHums();this.getIllsums();},methods:{asyncgetTems(){lettems=awaitgetTem();this.tems=tems;console.log(tems);},asyncgetHums(){lethums=awaitgetHum();this.hums=hums;},asyncgetIllsums(){letillsums=awaitgetIllsum();this.illsums=illsums;},draw:function(){letechart=echarts.init(document.getElementById('echarts'));varoption=({title:{text:'温度历史折线图'},tooltip:{},xAxis:{data:["5","4","3","2","最新"]},yAxis:{},series:[{name:'温度',type:'line',color:['red'],data:[]}]});for(vari=0;i
添加回答
举报
0/150
提交
取消