this.timer = setInterval(() => {
//每次向后滚动一个,最后一个从头开始。
let arr = MZdata;
if (option.dataZoom[0].endValue == arr.length) {
option.dataZoom[0].endValue = 9;
option.dataZoom[0].startValue = 0;
} else {
option.dataZoom[0].endValue = option.dataZoom[0].endValue + 1;
option.dataZoom[0].startValue = option.dataZoom[0].startValue + 1;
}
option && myChart.setOption(option, true);
}, 1500);
// 监听定时器在页面销毁前清除
this.$once("hook:beforeDestroy", () => {
clearInterval(this.timer);
});