yuhan пре 1 година
родитељ
комит
6499f57eab
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      itdmWeb/src/views/user/firstIndex.vue

+ 4 - 2
itdmWeb/src/views/user/firstIndex.vue

@@ -22,7 +22,7 @@
       // 设置定时器--因为初始执行方法时img没有加载完,所以获取不到高度;定时一段时间等img加载之后再执行
       this.timer = setTimeout(() => {
         this.setSystemStyle()
-      }, 100)
+      }, 1000)
       // this.$nextTick(() => {
       // })
       window.addEventListener('resize', this.setSystemStyle)
@@ -39,7 +39,9 @@
         // console.log(this.$refs)
         // 获取图片宽高和top以及left
         var systemWidth = this.$refs.systemContent.offsetWidth
-        var systemHeight = this.$refs.systemContent.offsetHeight
+        // var systemHeight = this.$refs.systemContent.offsetHeight
+        // 因为高度是动态的,所以初始化可能会出现获取不到高度的情况
+        var systemHeight = systemWidth * (700/1476)
         var systemTop = this.$refs.systemContent.offsetTop
         var systemLeft = this.$refs.systemContent.offsetLeft
         // console.log(systemWidth, systemHeight, systemTop, systemLeft)