Browse Source

添加鼠标滚动滚轮监听图层高度事件

lkk 7 months ago
parent
commit
8ab9b66baf
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/views/remote/MapView.vue

+ 10 - 0
src/views/remote/MapView.vue

@@ -251,6 +251,16 @@ export default {
       });
       this.maps[target] = map;
       window.map = this.maps;
+      window.map[target].on("moveend", function (e) {
+        var zoom = window.map[target].getView().getZoom(); //获取当前地图的缩放级别
+        console.log(zoom);
+        if (zoom >= 12) {
+          // tianjinlayer.getSource().clear(); //控制地图图层不可见
+          console.log('我大于12');
+        } else {
+          console.log('我小于12');
+        }
+      });
     },
   },
   mounted() {