myChart.setOption(option); myChart.getZr().on('click', params => { // 规定代码块↓↓ const pointInPixel = [params.offsetX, params.offsetY]; if (myChart.containPixel('grid', pointInPixel)) { const xIndex = myChart.convertFromPixel({seriesIndex: 0}, [params.offsetX, params.offsetY])[0]; // 规定代码块↑↑ let routeUrl; // x轴数据 this.barechartsData.forEach((item, index) => { if (index === xIndex) { routeUrl = this.$router.resolve({ path: '/page', // 跳转新页面 query: {item} }); } }); window.open(routeUrl.href, '_blank'); } });
标签:routeUrl,myChart,新页面,柱状图,params,跳转 From: https://www.cnblogs.com/qing1224/p/18153531