Browse Source

滚动判断调整

yangc 8 years ago
parent
commit
4da4624c20
1 changed files with 5 additions and 3 deletions
  1. 5 3
      components/mobile/store/StoreDetail.vue

+ 5 - 3
components/mobile/store/StoreDetail.vue

@@ -17,7 +17,7 @@
     </div>
     </div>
     <div class="product-store" v-if="activeType == 'product'">
     <div class="product-store" v-if="activeType == 'product'">
       <table v-if="commodities.content&&commodities.content.length > 0">
       <table v-if="commodities.content&&commodities.content.length > 0">
-        <thead :class="{'active': isScrollOverTab}">
+        <thead id="product-head" :class="{'active': isScrollOverTab}">
         <tr>
         <tr>
           <th style="width: 1.77rem;">型号/品牌</th>
           <th style="width: 1.77rem;">型号/品牌</th>
           <th style="width: 1.75rem;">包装</th>
           <th style="width: 1.75rem;">包装</th>
@@ -150,8 +150,10 @@
         if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchingMore && this.page < this.allPage && this.activeType === 'product') {
         if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchingMore && this.page < this.allPage && this.activeType === 'product') {
           this.getMoreCom()
           this.getMoreCom()
         }
         }
-        let theadObj = document.getElementById('product-body')
-        this.isScrollOverTab = theadObj.getBoundingClientRect().top <= 78
+        let tbodyObj = document.getElementById('product-body')
+        let theadObj = document.getElementById('product-head')
+//        console.log(theadObj.height)
+        this.isScrollOverTab = tbodyObj.getBoundingClientRect().top <= theadObj.getBoundingClientRect().height
       },
       },
       getMoreCom: function () {
       getMoreCom: function () {
         if (!this.isSearchingMore) {
         if (!this.isSearchingMore) {