** 需求:echart表 为店铺每个月的销售额,点击柱状 跳转到 【月报表页面】 **
// echarts 点击事件
this.chart.getZr().on('click', params =>
const pointInPixel = [params.offsetX, params.offsetY]
if (this.chart.containPixel('grid', pointInPixel)) {
// 点击第几个柱子
const pointInGrid = this.chart.convertFromPixel({ seriesIndex: 0 }, pointInPixel)
// x轴数据的索引
const xIndex = pointInGrid[0]
const xstr = this.xData[xIndex]
//执行父组件的方法
this.$emit('clickBar', xIndex)
// console.log(xstr,xIndex)
}
})
// 父组件的方法
clickBar(index){
this.$router.push({ name: 'MouthReport', params: { id:index
}