소스 검색

fix:修复小地图位置问题

zhu.yawen 1 년 전
부모
커밋
41e86f1865
1개의 변경된 파일14개의 추가작업 그리고 4개의 파일을 삭제
  1. 14 4
      data-room-ui/packages/BigScreenDesign/SettingPanel.vue

+ 14 - 4
data-room-ui/packages/BigScreenDesign/SettingPanel.vue

@@ -63,18 +63,28 @@ export default {
   },
   data () {
     return {
+      count: 0,
+      right: 0
     }
   },
   watch: {
     rightVisiable (value) {
+      const leftElement = document.querySelector('.bs-left-panel')
+      const contentElement = document.querySelector('.grid-wrap-box')
+      // const rightElement = document.querySelector('.bs-right-panel-wrap')
+      const mapElement = document.querySelector('.minimap')
       if (value) {
-        const leftElement = document.querySelector('.bs-left-panel')
-        const contentElement = document.querySelector('.grid-wrap-box')
-        // const rightElement = document.querySelector('.bs-right-panel-wrap')
-        const mapElement = document.querySelector('.minimap')
         if (parseInt(window.getComputedStyle(mapElement).right) > parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width)) {
+          // 此时距离超出可视范围
+          this.count = 1
+          this.right = window.getComputedStyle(mapElement).right
           mapElement.style.right = parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width) + 'px'
         }
+      } else {
+        if (this.count === 1) {
+          mapElement.style.right = this.right
+          this.count--
+        }
       }
     }
   },