Просмотр исходного кода

chore: 修复地图弹窗显示逻辑,只在home页面显示弹窗

sequoia tungfang недель назад: 3
Родитель
Сommit
e4e2698d71
1 измененных файлов с 9 добавлено и 9 удалено
  1. 9 9
      src/components/TongzhouTrafficMap.vue

+ 9 - 9
src/components/TongzhouTrafficMap.vue

@@ -173,7 +173,7 @@ export default {
       return this.activeLegends.length === this.statusConfig.length;
     },
     isHomePage() {
-      return this.$route && this.$route.path === '/home';
+      return this.$route && (this.$route.path === '/home' || this.$route.path === '/surve');
     },
     legendShowBtnStyle() {
       if (!this.isHomePage) return {};
@@ -714,7 +714,7 @@ export default {
         marker.on('click', (e) => {
           if (this.isComponentDestroyed) return;
           const extData = e.target.getExtData();
-          if (this.isHomePage) {
+          if (this.$route && this.$route.path === '/home') {
             this.cancelCloseInfoWindow();
             this.openLightInfo(extData, e.lnglat);
           }
@@ -725,10 +725,10 @@ export default {
 
         marker.on('mouseover', (e) => {
           if (this.isComponentDestroyed) return;
-          if (!this.isHomePage) return;
-          this.cancelCloseInfoWindow();
-          this.openLightInfo(e.target.getExtData(), e.lnglat);
-
+          if (this.$route && this.$route.path === '/home') {
+            this.cancelCloseInfoWindow();
+            this.openLightInfo(e.target.getExtData(), e.lnglat);
+          }
           // 获取像素坐标
           const pixel = this.map.lngLatToContainer(e.lnglat);
           // 传递路口鼠标滑入事件
@@ -737,9 +737,9 @@ export default {
 
         marker.on('mouseout', (e) => {
           if (this.isComponentDestroyed) return;
-          if (!this.isHomePage) return;
-          this.scheduleCloseInfoWindow();
-
+          if (this.$route && this.$route.path === '/home') {
+            this.scheduleCloseInfoWindow();
+          }
           // 传递路口鼠标滑出事件
           this.$emit('map-crossing-mouseout', e.target.getExtData());
         });