Kaynağa Gözat

iOS底部适配优化

zhujindu 11 ay önce
ebeveyn
işleme
c90b959ac4

+ 3 - 0
src/views/deviceOutside/index.vue

@@ -736,6 +736,9 @@ export default {
       this.otherShow = false;
     }
     this.getMonth();
+  },
+  mounted() {
+    // 解决iOS 上拉边界下拉出现白色空白
     let node = document.getElementsByClassName('deviceOutside')[0];
     node.addEventListener(
       'touchmove',

+ 18 - 1
src/views/deviceWithin/index.vue

@@ -45,7 +45,7 @@
       </div>
     </div>
     <!--        主体内容-->
-    <div class="container content" style="margin-top: 190px">
+    <div class="container content" style="margin-top: 190px" @touchmove="handleTouch">
       <div class="cellcontent" v-for="(item, index) in list" :key="index">
         <van-cell>
           <div class="card">
@@ -448,7 +448,24 @@ export default {
       this.getUserInPlanList();
     });
   },
+  mounted() {
+    // 解决iOS 上拉边界下拉出现白色空白
+    let node = document.getElementsByClassName('deviceWithin')[0];
+    node.addEventListener(
+      'touchmove',
+      (e) => {
+        if (e._isScroller) return;
+        e.preventDefault();
+      },
+      {
+        passive: false,
+      }
+    );
+  },
   methods: {
+    handleTouch(e) {
+      e._isScroller = true;
+    },
     linkapp(val) {
       var poind = this.gcj02BD(val.lat, val.lon);
       let url = window.location.href;