1、安装Echarts
npm install echarts --save
2、使用Echarts
<template>
<el-row :gutter="20">
<el-col :span="24">
<div class="echarts-div">
<div id="main" style="height: 100%; width: 100%; padding: 10px;"></div>
</div>
</el-col>
</el-row>
</template>
<script>
import * as echarts from "echarts"
export default {
data() {
return {
dataList: [],
}
},
created() {
this.getData();
},
mounted() {
// this.drawChart();
},
methods: {
drawChart() {
let myChart = echarts.init(document.getElementById("main"))
let option = {
};
if (option && typeof option === "object") {
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.