maxiaoxiao 8 tháng trước cách đây
mục cha
commit
b91130cbd7
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      src/views/remote/farmland/index.vue

+ 5 - 4
src/views/remote/farmland/index.vue

@@ -3,7 +3,7 @@
     <div class="btn">
       <el-button @click="drawer = true">打开抽屉</el-button>
     </div>
-    <MapView />
+    <MapView ref="MapView" />
 
     <el-drawer
       :visible.sync="drawer"
@@ -144,6 +144,7 @@ export default {
   methods: {
     tableClick(row) {
       let url = this.newObj.proxypath + row.hsxtif;
+      this.$refs.MapView.createMap('split')
       console.log(row, "-----", url);
       const source = new GeoTIFF({
         sources: [
@@ -199,7 +200,7 @@ export default {
         }
       }
       let fullExtent = this.curPageResultLayer.getSource().getExtent();
-      window.map.getView().fit(fullExtent, {
+      window.map['mapDiv'].getView().fit(fullExtent, {
         duration: 3, //动画的持续时间,
         callback: null,
       });
@@ -221,7 +222,7 @@ export default {
             }),
           }),
         });
-        window.map.addLayer(this.vectorLayer);
+        window.map['mapDiv'].addLayer(this.vectorLayer);
       }
       if (!this.curPageResultLayer) {
         let vectorSource = new VectorSource();
@@ -235,7 +236,7 @@ export default {
             }),
           }),
         });
-        window.map.addLayer(this.curPageResultLayer);
+        window.map['mapDiv'].addLayer(this.curPageResultLayer);
       }
     },
   },