| | |
| | | this.polygonLayer.on('pm:edit', e => { |
| | | // 拖动后的坐标 |
| | | that.polygons = e.target._latlngs[0] |
| | | |
| | | |
| | | var arr = [] |
| | | |
| | | this.polygons.forEach(item => { |
| | | arr.push([item.lng, item.lat]) |
| | | }) |
| | | |
| | | arr.push([this.polygons[0].lng, this.polygons[0].lat]) |
| | | |
| | | let area = this.$turf.area(this.$turf.polygon([arr])) |
| | | window.parent.postMessage(area,"*") |
| | | |
| | | |
| | | }) |
| | | this.polygonLayer.on('pm:vertexadded', e => { |
| | | // 添加顶点 |
| | |
| | | e.layer.on('pm:vertexadded', e => { |
| | | console.log(e, "添加顶点") |
| | | }) |
| | | |
| | | var arr = [] |
| | | |
| | | this.polygons.forEach(item => { |
| | | arr.push([item.lng, item.lat]) |
| | | }) |
| | | |
| | | arr.push([this.polygons[0].lng, this.polygons[0].lat]) |
| | | |
| | | let area = this.$turf.area(this.$turf.polygon([arr])) |
| | | window.parent.postMessage(area,"*") |
| | | }) |
| | | }, |
| | | |