1.下载安装
npm/cnpm install echarts --save
2.导包(导入需要的包,也可以全局引入进行配置)
import * as echarts from 'echarts';
3.代码(此处使用的假数据)
<template>
<div>
<van-row style="padding-top: 10px;padding-bottom: 10px">
<van-col span="12">
<div id="weekmain" style="width: 400px;height: 300px"></div>
</van-col>
<van-col span="12">
<div id="monthmain" style="width: 400px;height: 300px"></div>
</van-col>
</van-row>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
name: "myweek",
data(){
return{
}
},
methods:{
getmonth(){
var chartDom = document.getElementById('monthmain');
var myChart = echarts.init(chartDom);
var option;
// prettier-ignore
let dataAxis = ['12-1', '12-2', '12-3', '12-4', '12-5', '12-6', '12-7', '12-8', '12-9', '12-10', '12-11', '12-12', '12-13', '12-14', '12-15', '12-16', '12-17', '12-18', '12-19', '12-20'];
// prettier-ignore
let data = [100, 99, 11, 34, 90, 3