前言
前段时间项目经理和我说要搞一个日历图表出来,思来想去最终还是决定用echarts去实现,上文提过echarts的基本运用方法(不了解的可以移步这里),这里就不在赘述。在这记录自己的实现过程与大家分享,有不当之处也希望大家可以指出。
引用
import echarts from 'echarts';
ionViewDidEnter(){
let lunarData = [];
//获取当前年月
this.months = new Date().getMonth() + 1;
this.years = new Date().getFullYear();
if (this.months < 10) {
this.months = '0' + this.months;
}
this.titinfo = this.years.toString() + '-' + this.months.toString();
let myChart = echarts.init(<HTMLDivElement>document.getElementById('puEcharts'));
//循环日历时间
let dates = +echarts.number.parseDate(this.years + '-01-01');
let end = +echarts.number.parseDate(this.years + '-12-31');
let