Sfoglia il codice sorgente

fix: 地图路口圆点新增根据路由区分现实交互方式,首页点击,其他的移入移出

sequoia tungfang 4 settimane fa
parent
commit
2b32fa4fa2
1 ha cambiato i file con 11 aggiunte e 2 eliminazioni
  1. 11 2
      src/components/TongzhouTrafficMap.vue

+ 11 - 2
src/components/TongzhouTrafficMap.vue

@@ -170,6 +170,9 @@ export default {
     isAllSelected() {
       return this.activeLegends.length === this.statusConfig.length;
     },
+    isHomePage() {
+      return this.$route && this.$route.path === '/home';
+    },
     legendStatusConfig() {
       if (!this.mode) return this.statusConfig;
       if (this.mode === '路口') {
@@ -691,19 +694,25 @@ export default {
         });
 
         marker.on('click', (e) => {
-          if (!this.isComponentDestroyed) {
-            this.$emit('map-crossing-click', e.target.getExtData(), e.lnglat);
+          if (this.isComponentDestroyed) return;
+          const extData = e.target.getExtData();
+          if (this.isHomePage) {
+            this.cancelCloseInfoWindow();
+            this.openLightInfo(extData, e.lnglat);
           }
+          this.$emit('map-crossing-click', extData, e.lnglat);
         });
 
         marker.on('mouseover', (e) => {
           if (this.isComponentDestroyed) return;
+          if (this.isHomePage) return;
           this.cancelCloseInfoWindow();
           this.openLightInfo(e.target.getExtData(), e.lnglat);
         });
 
         marker.on('mouseout', () => {
           if (this.isComponentDestroyed) return;
+          if (this.isHomePage) return;
           this.scheduleCloseInfoWindow();
         });