From f0b1e71c2834109bd3fd333f37eca3c0c607dbd8 Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期五, 30 七月 2021 12:04:13 +0800 Subject: [PATCH] 地图站点跳转 --- src/pages/index.vue | 16 ++++++++++++++-- src/components/chart/chinaMap.vue | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/chart/chinaMap.vue b/src/components/chart/chinaMap.vue index 7be8a3b..0cff63a 100644 --- a/src/components/chart/chinaMap.vue +++ b/src/components/chart/chinaMap.vue @@ -1,6 +1,6 @@ <template> <div class="echarts-wrapper"> - <div class="echarts-content" ref="chart"></div> + <div class="echarts-content" ref="chart" :id="id"></div> </div> </template> diff --git a/src/pages/index.vue b/src/pages/index.vue index d95ef0c..2c5f741 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -90,10 +90,23 @@ }) } this.$nextTick(() => { - this.initCityChart(); + this.initPage(); }); }).catch((err) => { console.log(err); + }); + }, + initPage() { + // 鍒濆鍖栧湴鍥� + this.initCityChart(); + chart = ECharts.init(document.getElementById('cityChart')); + chart.off('click'); //闃叉chart鐐瑰嚮瑙﹀彂澶氭 + chart.on("click", params => { //鐐瑰嚮璺宠浆瀹炴椂鏁版嵁 + if (params.seriesType == "scatter") { + this.$router.push({ + path: '/functionList' + }) + } }); }, initCityChart() { @@ -262,7 +275,6 @@ }] }; } - console.log(option) this.$refs.cityChart.setData(option); }, mergeMapInfos(list) { -- Gitblit v1.9.1