From 7366b0a279425cb6218bec8ba19774e5e8399b91 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Tue, 15 Mar 2022 14:34:37 +0800
Subject: [PATCH] +把DC拉出vue实例中,解决vue内存溢出问题

---
 src/store/modules/mobiles/urlParameter.js |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/store/modules/mobiles/urlParameter.js b/src/store/modules/mobiles/urlParameter.js
index 883a7bf..0c9b6af 100644
--- a/src/store/modules/mobiles/urlParameter.js
+++ b/src/store/modules/mobiles/urlParameter.js
@@ -1,22 +1,26 @@
+window.urlParameterLayer = null;
+window.divIcon = null;
+
+
 const urlParameter = {
     state: {
         urlParameterData: {},
-        urlParameterLayer: null // 自定义标签图层
+        // urlParameterLayer: null // 自定义标签图层
     },
     actions: {
-        addurlParameterLayerIcon ({
+        addurlParameterLayerIcon({
             state,
             commit,
             dispatch
         }, val) {
             const list = val.list
             if (val.clear) {
-                //     state.urlParameterLayer.remove();
-                state.urlParameterLayer.clear()
+                //     window.urlParameterLayer.remove();
+                window.urlParameterLayererLayer.clear()
             }
             for (const i in list) {
                 // console.log(list[i], 112233)
-                const divIcon = new global.DC.DivIcon(
+                window.divIcon = new global.DC.DivIcon(
                     new global.DC.Position(
                         Number(list[i].jd),
                         Number(list[i].wd),
@@ -33,7 +37,7 @@
                           </div>
                       `
                 )
-                divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+                window.divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                     const lntLat = [+list[i].jd, +list[i].wd]
                     const d = {
                         position: {},
@@ -48,27 +52,27 @@
                     }
                     dispatch('setMobileWindows', d)
                 })
-                state.urlParameterLayer.addOverlay(divIcon)
+                window.urlParameterLayer.addOverlay(window.divIcon)
             }
         }
     },
     mutations: {
-        initurlParameterLayer (state, val) {
-            if (!state.urlParameterLayer) {
-                state.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
-                state.mviewer.addLayer(state.urlParameterLayer)
+        initurlParameterLayer(state, val) {
+            if (!window.urlParameterLayer) {
+                window.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
+                global.viewer.addLayer(window.urlParameterLayer)
             }
         },
-        set_urlParameterData (state, val) {
+        set_urlParameterData(state, val) {
             state.urlParameterData = val
         },
 
-        clearurlParameterLayerIcon (state, val) {
-            if (state.urlParameterLayer) {
-                state.urlParameterLayer.clear()
+        clearurlParameterLayerIcon(state, val) {
+            if (window.urlParameterLayer) {
+                window.urlParameterLayer.clear()
             }
         }
     }
 }
 
-export default urlParameter
+export default urlParameter
\ No newline at end of file

--
Gitblit v1.9.3