美文网首页
vue使用echart,报错

vue使用echart,报错

作者: 小丸子超级可爱 | 来源:发表于2018-10-25 10:40 被阅读0次

echart使用步骤

1.在页面上写一个id的标签

<div id="echart" style="width:80%;height:350px;"></div>

2.在mounted里面找到标签

const bestSeller = this.echarts.init(document.getElementById("echart"));

一定要在mounted里面,created里面是获取不到id的,节点还没有加载,所以会报错

3.可以粘贴options了(去官网里面需要那种粘哪种)

xAxis,yAxis     可以控制坐标轴消失的

4.把参数放到dom里面

bestSeller.setOption(option);

相关文章

网友评论

      本文标题:vue使用echart,报错

      本文链接:https://www.haomeiwen.com/subject/hrxmzftx.html