vue使用高德地图点击下钻上浮效果的实现思路

2020-06-12 20:52:44易采站长站整理

for (var i = 0, len = areaNodes.length; i < len; i++) {
renderAreaNode(areaNodes[i]);
}
//更新地图视野
that.map.setFitView(that.districtExplorer.getAllFeaturePolygons());
});
//添加点标记
that.addMarker(data);
});

this.adcodes是区码,这里的关键在于清空,利用好

 that.map.clearMap(); 
//清空所有绘制物 再重新进行绘制,再通过
that.map.setFitView(that.districtExplorer.getAllFeaturePolygons());
就可以达到下钻的效果,上浮也是同理。

区码以浙江省为例


if (data.result.rows[0].cities_name == "杭州市") {
this.adcodes = [330100];
} else if (data.result.rows[0].cities_name == "宁波市") {
this.adcodes = [330200];
} else if (data.result.rows[0].cities_name == "温州市") {
this.adcodes = [330300];
} else if (data.result.rows[0].cities_name == "嘉兴市") {
this.adcodes = [330400];
} else if (data.result.rows[0].cities_name == "湖州市") {
this.adcodes = [330500];
} else if (data.result.rows[0].cities_name == "绍兴市") {
this.adcodes = [330600];
} else if (data.result.rows[0].cities_name == "金华市") {
this.adcodes = [330700];
} else if (data.result.rows[0].cities_name == "衢州市") {
this.adcodes = [330800];
} else if (data.result.rows[0].cities_name == "舟山市") {
this.adcodes = [330900];
} else if (data.result.rows[0].cities_name == "台州市") {
this.adcodes = [331000];
} else if (data.result.rows[0].cities_name == "丽水市") {
this.adcodes = [331100];
}

总结

以上所述是小编给大家介绍的vue使用高德地图点击下钻上浮效果的实现思路,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!