彈出 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>
