BUG 30044

This commit is contained in:
aixianling
2022-06-07 17:46:19 +08:00
parent 70e1337980
commit 0b89f4c0a1
2 changed files with 7 additions and 6 deletions

View File

@@ -118,7 +118,6 @@ export default {
}) })
this.polyEditor.on('end', ({target}) => { this.polyEditor.on('end', ({target}) => {
if (target) { if (target) {
console.log(target.getPath())
this.overlays.push(target); this.overlays.push(target);
this.points = target.getPath().map(e => ({lat: e.getLat(), lng: e.getLng()})) this.points = target.getPath().map(e => ({lat: e.getLat(), lng: e.getLng()}))
} }

View File

@@ -79,10 +79,12 @@ export default {
this.points = [] this.points = []
}, },
handleAdd() { handleAdd() {
let {polyEditor} = this if (this.points?.length == 0) {
polyEditor.close(); let {polyEditor} = this
polyEditor.setTarget(); polyEditor.close();
polyEditor.open(); polyEditor.setTarget();
polyEditor.open();
} else this.$message.error("请先清除已标绘图形!")
}, },
initMap() { initMap() {
setTimeout(() => AMapLoader.load({ setTimeout(() => AMapLoader.load({
@@ -117,7 +119,7 @@ export default {
this.polyEditor.on('end', ({target}) => { this.polyEditor.on('end', ({target}) => {
if (target) { if (target) {
this.overlays.push(target); this.overlays.push(target);
this.points.push(target.getPath().map((e) => ({lat: e.getLat(), lng: e.getLng()}))) this.points = target.getPath().map(e => ({lat: e.getLat(), lng: e.getLng()}))
} }
}); });
if (this.value?.length > 0) { if (this.value?.length > 0) {