Эх сурвалжийг харах

Merge remote-tracking branch 'origin/feature-wangcz-201814' into feature-wangcz-201814

shenjj 7 жил өмнө
parent
commit
c9b69d508e

+ 18 - 9
components/home/floor/FloorBar.vue

@@ -28,14 +28,23 @@
     },
     methods: {
       _calcaulateHeight() {
-        let _heis0 = document.querySelectorAll('header')[0].clientHeight
-        let _heis1 = document.querySelectorAll('.header.clearfix')[0].clientHeight
-        let _heis2 = document.querySelectorAll('.nav-list')[0].clientHeight
-        let _heis3 = document.querySelectorAll('.carousel')[0].clientHeight
-        let _heis4 = document.querySelectorAll('.advert-slide')[0].clientHeight
-        let _heis5 = document.querySelectorAll('.banner')[0].clientHeight
-        let _heis6 = document.querySelectorAll('.floor.price-floor')[0].clientHeight
-        let _heis7 = document.querySelectorAll('.floor.price-floor')[1].clientHeight
+        let nullObj = {clientHeight: 0}
+        let obj0 = document.querySelectorAll('header')[0] || nullObj
+        let obj1 = document.querySelectorAll('.header.clearfix')[0] || nullObj
+        let obj2 = document.querySelectorAll('.nav-list')[0] || nullObj
+        let obj3 = document.querySelectorAll('.carousel')[0] || nullObj
+        let obj4 = document.querySelectorAll('.advert-slide')[0] || nullObj
+        let obj5 = document.querySelectorAll('.banner')[0] || nullObj
+        let obj6 = document.querySelectorAll('.floor.price-floor')[0] || nullObj
+        let obj7 = document.querySelectorAll('.floor.price-floor')[1] || nullObj
+        let _heis0 = obj0.clientHeight
+        let _heis1 = obj1.clientHeight
+        let _heis2 = obj2.clientHeight
+        let _heis3 = obj3.clientHeight
+        let _heis4 = obj4.clientHeight
+        let _heis5 = obj5.clientHeight
+        let _heis6 = obj6.clientHeight
+        let _heis7 = obj7.clientHeight
         this.bannerHeight = _heis0 + _heis1 + _heis2 + _heis3 + _heis4 + _heis5 + _heis6 + _heis7
         this.listHeight = []
         this.list = document.querySelectorAll('.normal-floor')
@@ -101,7 +110,7 @@
       }
     },
     mounted: function () {
-      this.$nextTick(function () {
+      this.$nextTick(() => {
         this._calcaulateHeight()
         window.addEventListener('scroll', this.onScroll)
       })