Browse Source

增加删除

SunZehao 7 months ago
parent
commit
911fb30cba
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/views/mapAnalysis/index.vue

+ 12 - 1
src/views/mapAnalysis/index.vue

@@ -132,6 +132,17 @@ const initMap = () => {
 
 
     console.log('editmove====>>>', e)
     console.log('editmove====>>>', e)
   })
   })
+
+  map.on(L.Draw.Event.DELETED, function (e) {
+    console.log('deleted====>>>', e)
+    for (let i in e.layers._layers) {
+      drawLayers.value.forEach((it, index) => {
+        if (it.layer._leaflet_id.toString() === i) {
+          drawLayers.value.splice(index, 1)
+        }
+      })
+    }
+  })
 }
 }
 const initDrawTooltip = () => {
 const initDrawTooltip = () => {
   L.drawLocal.draw.handlers.polygon = {
   L.drawLocal.draw.handlers.polygon = {
@@ -221,7 +232,7 @@ onMounted(() => {
   background: #fff
   background: #fff
   overflow-y: auto
   overflow-y: auto
   .title
   .title
-    font-size: 16px
+    font-size: 15px
     font-weight: bold
     font-weight: bold
   .detailMsg
   .detailMsg
     margin: 10px 0
     margin: 10px 0