ソースを参照

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

maxiaoxiao 9 ヶ月 前
コミット
e5184781e6
1 ファイル変更35 行追加8 行削除
  1. 35 8
      src/components/Combinations/LayerManage/LayerLegend.vue

+ 35 - 8
src/components/Combinations/LayerManage/LayerLegend.vue

@@ -6,9 +6,13 @@
       checkedVector.length > 0 &&
       ($route.path !== '/overview' || !store.state.viewer_flag)
     "
-    :class="{ hidelegends: !showlist }"
+    :style="`position: absolute;left: 40px;top:${top}vh;height:${height}px`"
   >
-    <span @click="showlist = !showlist">
+    <!-- :class="showlist ? 'oneLeng' : 'hidelegends'" -->
+    <!-- :class="{ hidelegends: !showlist }" -->
+    <!-- :style="`height:${height}px`" -->
+    <!-- <span @click="showlist = !showlist"> -->
+    <span @click="isShowList">
       图例
       <div class="eicon" :class="showlist ? 'eyes' : 'close_eyes'"></div>
     </span>
@@ -43,6 +47,8 @@ export default {
       showlist: false,
       activeNames: [],
       vectors: [],
+      top: 90,
+      height: 40,
     };
   },
   computed: {
@@ -50,8 +56,27 @@ export default {
       return store.state.checkedNode.filter((ci) => ci.type == "Vector");
     },
   },
-  mounted() {},
+  mounted() {
+    window.onresize = () => {
+      //写在mounted中,onresize事件会在页面大小被调整时触发
+      return (() => {
+        // (window.screenHeight = document.body.clientHeight),
+        //   (this.height = window.screenHeight);
+      })();
+    };
+  },
   methods: {
+    isShowList() {
+      if (this.showlist) {
+        this.top = 90;
+        this.height = 40;
+        this.showlist = false
+      } else {
+        this.top = 70;
+        this.height = 250;
+        this.showlist = true
+      }
+    },
     async Getbbox(vdata) {
       let url = `${vdata.url}.json`;
       let res = await axios.get(url);
@@ -90,11 +115,11 @@ export default {
 
 <style lang="scss" >
 .legends {
-  position: absolute;
-  left: 40px;
-  top: 60vh;
+  // position: absolute;
+  // left: 40px;
+  // top: 70vh;
+  // height: 250px;
   width: 150px;
-  height: 250px;
   cursor: pointer;
   background: url(/static/images/ghzc/内容框.png) no-repeat;
   background-size: 100% 100%;
@@ -163,8 +188,10 @@ export default {
 }
 .hidelegends {
   position: absolute;
-  height: 40px;
+  left: 40px;
   top: 90vh !important;
+  height: 40px;
+  width: 150px;
 }
 
 // @import "../../../views/complianceAnalysis/ghzc.scss";