shenxin 5 éve
szülő
commit
81771a4207
1 módosított fájl, 14 hozzáadás és 13 törlés
  1. 14 13
      src/pages/index.vue

+ 14 - 13
src/pages/index.vue

@@ -6,7 +6,6 @@
       <view class="index-header">
         <view class="index-banner"
               v-if="bannerList.length"
-              v-show="!isSticky"
               :style="{
                 Top: `${logoTop}rpx`
               }">
@@ -23,8 +22,7 @@
           </u-swiper>
         </view>
       </view>
-      <view class="activity-flow"
-            v-show="!isSticky">
+      <view class="activity-flow">
         <activity-flow></activity-flow>
       </view>
     </view>
@@ -37,9 +35,11 @@
         <!-- 只能有一个根元素 -->
         <view class="sticky">
           <view class="nav-title u-font-32 bold line-44 u-text-center"
+                v-show="isSticky"
                 :style="{
-              paddingTop: `${navTitleStyle.paddingTop}rpx`,
+              marginTop: `${navTitleStyle.paddingTop}px`,
               lineHeight: `${navTitleStyle.lineHeight}rpx`,
+              height: `${navTitleStyle.lineHeight}rpx`,
               fontSize: `${navTitleStyle.fontSize}rpx`,
               opacity: navTitleStyle.opacity
             }">
@@ -71,9 +71,10 @@
         </view>
       </u-sticky>
       <block v-if="isLocation">
-        <view class="activity-list"
-              :style="{paddingTop: `${activityListPT}rpx`}">
+        <view class="activity-list">
           <block v-if="activityList.length !== 0">
+            <view :style="{height:'244rpx'}"
+                  v-show="isSticky"></view>
             <view class="activity-card u-border-bottom"
                   v-for="(item, index) in activityList"
                   :key="index">
@@ -139,10 +140,10 @@ export default {
   },
   computed: {
     navHeight () {
-      return (uni.getSystemInfoSync().statusBarHeight * 2) + 16
+      return ((uni.getMenuButtonBoundingClientRect().top) + (uni.getMenuButtonBoundingClientRect().height - 22) / 2)
     },
     logoTop () {
-      return (uni.getMenuButtonBoundingClientRect().top * 2)
+      return ((uni.getMenuButtonBoundingClientRect().top) + (uni.getMenuButtonBoundingClientRect().height - 22) / 2) * 2
     }
   },
   onShow () {
@@ -229,19 +230,19 @@ export default {
     },
     stickyFixed () {
       this.isSticky = true
-      this.firstHeight = 0
+      // this.firstHeight = 0
       this.navTitleStyle = {
-        paddingTop: this.navHeight,
+        paddingTop: uni.getMenuButtonBoundingClientRect().top,
         paddingBottom: 30,
-        lineHeight: 44,
+        lineHeight: uni.getMenuButtonBoundingClientRect().height * 2,
         fontSize: 32,
         opacity: 1
       }
-      this.activityListPT = this.navHeight + 100
+      // this.activityListPT = this.navHeight + 100
     },
     unStickyFixed () {
       this.isSticky = false
-      this.firstHeight = 568
+      // this.firstHeight = 568
       this.navTitleStyle = {
         paddingTop: 0,
         paddingBottom: 0,