美文网首页
在Vue中使用Echart

在Vue中使用Echart

作者: Echo_前端 | 来源:发表于2018-11-06 14:59 被阅读0次

1\首先,在项目中获取 "echarts"   npm install echarts --save

2\在文件中引入 import  echarts  from  "echarts"  

3\在页面上写入Echart的元素,重要的一点是一定要写宽高样式,否则不能够正确显示

       <div id="main" style="width: 600px;height:400px;"></div>

4\注册元素完成初始化,data中写入需要的option配置

初始化

可能遇到的问题:

this.$refs.conponent.show() is not function   

排查:console.log(this.$refs.conponent)  ,确认是否正确获取到了组件,

如果组件正确,去排查组件中的事件是否存在(可能是methods函数本身就写错了)

相关文章

网友评论

      本文标题:在Vue中使用Echart

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