zoukankan      html  css  js  c++  java
  • 小程序弹窗禁止页面滚动

    弹出 fixed 弹窗后,在弹窗上滑动会导致下层的页面一起跟着滚动。

    解决方法:

    在弹出层加上 catchtouchmove 事件

    示例代码:

    <view class="modal-view" hidden="{{!showModal}}" bindtap="toggleModal" catchtouchmove="preventTouchMove">
      <view class="modal">
      <view class="modal-item" catchtap="makePhoneCall">{{site.phone}}</view>
      <view class="modal-item" catchtap="toggleModal">取消</view>
      </view>
    </view>
     
    Pages({
      preventTouchMove() {}
    })

    还有一种方法如下:给catchtouchmove="ture"

    <view class="modal-view" hidden="{{!showModal}}" bindtap="toggleModal" catchtouchmove="ture">
      <view class="modal">
      <view class="modal-item" catchtap="makePhoneCall">{{site.phone}}</view>
      <view class="modal-item" catchtap="toggleModal">取消</view>
      </view>
    </view>

  • 相关阅读:
    output在delete中的应用
    静态什么时候用?
    Main函数解析
    构造函数
    Main函数解析
    java类类型
    静态使用的注意事项
    Main函数剖析
    成员变量和局部变量的区别
    static的特点
  • 原文地址:https://www.cnblogs.com/rgqjson/p/10173313.html
Copyright © 2011-2022 走看看