![14c97ea49e43be457913eb9f3c09adbe.png](https://img-blog.csdnimg.cn/img_convert/14c97ea49e43be457913eb9f3c09adbe.png)
安装echarts依赖
npm install echarts -S
创建图表,在main.js中引入
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
在组件中使用
<template>
<div id="myChart" :style="{width: '500px', height: '500px'}"></div>
</template>
<script>
export default {
data () {
return {}
},
mounted(){
this.drawLine();
},
methods: {
drawLine() {
let myChart= this.$echarts.init(document.getElementById('myChart')