<template>
<div class="tubiao">
<div id="main" style="width: 600px;height:400px;"></div>
</div>
</template> <script>
import echarts from 'echarts';
export default {
name: 'tubiao',
data () {
return {
chart: null
}
},
methods:{
drawPie (id) {
this.chart = echarts.init(document.getElementById('main'));
this.chart.setOption({
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
}
},
mounted(){
this.$nextTick(function() {
this.drawPie('main');
var that = this;
var resizeTimer = null;
window.onresize = function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
that.drawPie('main');
}, 100);
}
});
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> </style>

先进行安装echarts,

然后在根据echarts官网的提示例子,进行开发练手,

最后就是配置一下路由,进行页面的跳转。

更多更好的效果,可以再echarts官网查看。

最新文章

  1. Disque:Redis之父新开源的分布式内存作业队列
  2. Spring Boot下配置MyBatis多数据源
  3. delegate用法
  4. office2003-2007 绿色版 出错 文件丢失(未解决)
  5. Scala 深入浅出实战经典 第47讲:Scala多重界定代码实战及其在Spark中的应用
  6. [NOIP2008] 提高组 洛谷P1006 传纸条
  7. 分享:shell去掉linux配置文件的注释行
  8. STORM_0010_Message passing implementation/消息传递的实现
  9. js自定义弹窗
  10. 张艾迪(创始人):拥抱单身与自由的Eidyzhang
  11. hive 子查询特别分析
  12. IOS_OC_本地推送知识总结
  13. CENTOS 挂载硬盘
  14. Dynamics CRM The difference between UserId and InitiatingUserId in Plugin
  15. LeetCode 单链表专题 (一)
  16. Linux环境下虚拟环境virtualenv安装和使用
  17. 《笨方法学Python》加分题28
  18. optimize PHP-FPM优化
  19. 如何让微信里的html应用弹出“点击右上角分享到朋友圈”的图片
  20. select 与 time.After 配合使用的问题

热门文章

  1. 网络初级篇之VLAN间路由(原理与配置)
  2. 8.9.网络编程_Socket 远程调用机制
  3. [Nginx]子目录反向代理kibana并添加basic认证
  4. 【JAVASCRIPT】call和apply的用法以及区别
  5. Ubuntu 18.04 启动太慢不能忍
  6. 查看ocx控件CLSID的方法(转载)
  7. 【leetcode】1283. Find the Smallest Divisor Given a Threshold
  8. 1、Socket通信
  9. WPF程序发布有关事项
  10. @RequestMapping的简单理解