diff --git a/src/views/gaode-demo/PointInRing.vue b/src/views/gaode-demo/PointInRing.vue index 4d93c9d..e6a8418 100644 --- a/src/views/gaode-demo/PointInRing.vue +++ b/src/views/gaode-demo/PointInRing.vue @@ -203,8 +203,11 @@ export default { // 创建圆形 createCircle() { console.log("this.map.center", this.map.center); + if(this.currentCircle) { + this.map.instance.remove(this.currentCircle) + } this.currentCircle = new AMap.Circle({ - center: this.circlePolygon.center, + center: this.map.center.toString().split(','), radius: this.circlePolygon.radius, borderWeight: 3, strokeColor: "red", @@ -223,7 +226,12 @@ export default { // 推拽圆 computeCircle() { let point = this.currentCircle.getCenter(); - this.circlePolygon.center = point; + //this.map.center = point; + if(this.map.marker) { + this.map.instance.remove(this.map.marker) + } + this.map.center = point.toString().split(',') + this.createMarker(); /* console.log("circleCenter", circleCenter); */ let polygonCircleListMap = this.polygonList.map(item => { return { @@ -251,6 +259,7 @@ export default { computeMarker() { let point = this.map.marker.getPosition(); this.map.center = point.toString().split(','); + this.createCircle(); /* console.log("circleCenter", circleCenter); */ let polygonCircleListMap = this.polygonList.map(item => { return {