瀏覽代碼

聚合卡顿问题

彭宇 2 年之前
父節點
當前提交
993a14b1e6
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/components/supermap.vue

+ 3 - 4
src/components/supermap.vue

@@ -1006,7 +1006,7 @@ export default {
         })
         })
         let markerClick = window.L.marker([markersList[i].lat, markersList[i].lng], {
         let markerClick = window.L.marker([markersList[i].lat, markersList[i].lng], {
           icon: icon
           icon: icon
-        }).addTo(this.map)
+        })
         if (markersList[i].bindPopupHtml != null && markersList[i].bindPopupHtml !== '') {
         if (markersList[i].bindPopupHtml != null && markersList[i].bindPopupHtml !== '') {
           let html = markersList[i].bindPopupHtml
           let html = markersList[i].bindPopupHtml
           if (keepBindPopup) {
           if (keepBindPopup) {
@@ -1040,14 +1040,13 @@ export default {
         if (isAggregation) {
         if (isAggregation) {
           _that.isAggregationLayers.addLayer(markerClick)
           _that.isAggregationLayers.addLayer(markerClick)
           _that.isAggregationMyGroup = window.L.layerGroup(_that.isAggregationLayers)
           _that.isAggregationMyGroup = window.L.layerGroup(_that.isAggregationLayers)
-          this.map.addLayer(_that.isAggregationLayers)
         } else {
         } else {
           _that.layers.push(markerClick)
           _that.layers.push(markerClick)
           _that.myGroup = window.L.layerGroup(_that.layers)
           _that.myGroup = window.L.layerGroup(_that.layers)
-          this.map.addLayer(_that.myGroup)
         }
         }
-
       }
       }
+      _that.map.addLayer(_that.myGroup)
+      _that.map.addLayer(_that.isAggregationLayers)
     },
     },
     setMarkersByType: function(markersList, type) { //地图标点(根据类型,可取消落点 clearMByType方法)
     setMarkersByType: function(markersList, type) { //地图标点(根据类型,可取消落点 clearMByType方法)
       const _that = this
       const _that = this