myEcharts.on('click', function(params) {//设置点击事件
var province = params.name;//获取选中省市的省市名称
switch(province) {
case '新疆':
location.href = '';//测试效果:选中新疆并触发点击事件后跳转到百度首页
break;
case '西藏':
location.href = '';
break;
case '云南':
location.href = '';
break;
case '广西':
location.href = '';
break;
case '广东':
location.href = '';
break;
case '海南':
location.href = '';
break;
case '澳门':
location.href = '';
break;
case '香港':
location.href = '';
break;
case '台湾':
location.href = '';
break;
case '福建':
location.href = '';
break;
case '浙江':
location.href = '';
break;
case '上海':
location.href = '';
break;
case '江苏':
location.href = '';
break;
case '山东':
location.href = '';
break;
case '天津':
location.href = '';
break;
case '北京':
location.href = '';
break;
case '辽宁':
location.href = '';
break;
case '吉林':
location.href = '';
break;
case '黑龙江':
location.href = '';
break;
case '内蒙古':
location.href = '';
break;
case '宁夏':
location.href = '';
break;
case '青海':
location.href = '';
break;
case '甘肃':
location.href = '';
break;
case '四川':
location.href = '';
break;
case '重庆':
location.href = '';
break;
case '贵州':
location.href = '';
break;
case '湖南':
location.href = '';
break;
case '湖北':
location.href = '';
break;
case '河南':
location.href = '';
break;
case '陕西':
location.href = '';
break;
case '山西':
location.href = '';
break;
case '河北':
location.href = '';
break;
case '安徽':
location.href = '';
break;
default:
break;
}
});
ps:当选项较多时使用switch-case 比 if-else快
如果觉得《echart 页面跳转_echarts3地图实现点击某省市区域跳转到相应页面》对你有帮助,请点赞、收藏,并留下你的观点哦!