有个项目,需要点击回显之前绘制的圆形区域,第一次回显可以正常显示,第二次再回显的时候出现问题,跪求各位大佬帮忙看看
<baidu-map class="map h-full" style="height:calc(100vh - 6.6rem)" ak="TIj3pFan1kg1l**********nW1gR" :center="mapForm.center" :zoom="mapForm.zoom" :scroll-wheel-zoom="true" @ready="mapSelhandler">
<bm-circle v-if="mapForm.shapeType == 1" :center="mapForm.circlePath.center" :radius="mapForm.circlePath.radius" stroke-color="blue" :stroke-opacity="0.5" :stroke-weight="2" @lineupdate="updateCirclePath" :editing="true"></bm-circle>
</baidu-map>
js
goEdit(param){
//点击编辑,获取信息
let obj = {id : param.id};
this.$api.eleFenceDetail(obj).then((res) => {
if (res.success == true) {
let data = res.data;
this.$nextTick(() => {
this.editForm = JSON.parse(JSON.stringify(data)) ;
this.carInfoList = JSON.parse(JSON.stringify(data.carInfoList)) ;
this.editForm.shapeDetail = JSON.parse(this.editForm.shapeDetail);
let {lng, lat} = GpsConverter.gps_baidu(this.editForm.shapeDetail.center.lng, this.editForm.shapeDetail.center.lat);
this.editForm.shapeDetail.center.lng = lng;
this.editForm.shapeDetail.center.lat = lat;
//解析图形
this.addRegion();
});
} else {
this.$message({
message: res.msg,
type: 'error'
});
}
})
},
addRegion(){
this.mapForm.polygonPath = [];
this.mapForm.circlePath.center = {
lng: '',
lat: ''
};
this.mapForm.circlePath.radius = "";
this.$set(this.mapForm.circlePath,"center",this.editForm.shapeDetail.center)
this.$set(this.mapForm.circlePath,"radius",this.editForm.shapeDetail.radius)
that.$set(this.mapForm,"center",this.editForm.shapeDetail.center);
},
//修改图形返回的数据
updateCirclePath (e) {
this.mapForm.circlePath.center = e.target.getCenter();
this.mapForm.circlePath.radius = e.target.getRadius();
e.target.enableEditing();
},