Browse Source

集团首页修改深浅版本切换后字体颜色不变的bug

fujunwen 4 years ago
parent
commit
1b6f8ad300
1 changed files with 21 additions and 24 deletions
  1. 21 24
      src/views/statistics/index.vue

+ 21 - 24
src/views/statistics/index.vue

@@ -531,29 +531,27 @@ export default {
     */
     changeSkin() {
       const vm = this
-      const mapDom = document.querySelector("#map")
-      const icons = mapDom.querySelectorAll(".my-leaflet-div-icon")
-      this.$nextTick(()=>{
-          if (this.skinMode === 'light') {
-              this.skinMode = 'dark'
-              icons.forEach(dom => {
-                dom.style.color = "#FFF"
-              })
-          } else {
-              this.skinMode = 'light'
-              icons.forEach(dom => {
-                dom.style.color = "#333"
-              })
-          }
-          if (this.mapLayer) {
-            this.mapLayer.setStyle({
-              weight: 1,
-              color: vm.skinMode === "light" ? "#B3D2FF" :"#56a3c2",
-              fillColor: vm.skinMode === "light" ? "#DEECFF" : "#21285c",
-              fillOpacity: vm.skinMode === "light" ? 0.2 : 1
-            })
-          }
-      })
+      const mapDom = document.querySelector("#map .leaflet-marker-pane")
+      const icons = mapDom.querySelectorAll(".leaflet-marker-icon")
+      if (this.skinMode === 'light') {
+          this.skinMode = 'dark'
+          icons.forEach(dom => {
+            dom.style.color = "#FFF"
+          })
+      } else {
+          this.skinMode = 'light'
+          icons.forEach(dom => {
+            dom.style.color = "#333"
+          })
+      }
+      if (this.mapLayer) {
+        this.mapLayer.setStyle({
+          weight: 1,
+          color: vm.skinMode === "light" ? "#B3D2FF" :"#56a3c2",
+          fillColor: vm.skinMode === "light" ? "#DEECFF" : "#21285c",
+          fillOpacity: vm.skinMode === "light" ? 0.2 : 1
+        })
+      }
     },
     downloadExcel() {
       let tableContent = document.querySelector("#tableReport").outerHTML;
@@ -1557,7 +1555,6 @@ export default {
         popup.on('add' , (ev) => {
            let popupDom = document.querySelectorAll('.leaflet-mypopup-content')[0]
            let tipDom = document.querySelectorAll('.leaflet-popup-tip')[0]
-           console.log(tipDom)
            if (this.skinMode === 'light') {
              popupDom.setAttribute('class', 'leaflet-mypopup-content')
              tipDom.style.background="white"