微信小程序-自制弹出框禁止页面上下滑动
时间:2018-09-06 16:15:36
收藏:0
阅读:388
弹出 fixed 弹窗后,在弹窗上滑动会导致下层的页面一起跟着滚动。
解决方法:
在弹出层加上 catchtouchmove 事件
两种方法:(在电脑上测试是没有用的,这是触摸事件。因此,需要在手机端测试,预览生成一个开发版,用手机微信扫描即可看到效果)
1.
wxml:
<!-- 首页弹窗 -->
<view class=‘Popup‘ hidden=‘{{bool}}‘ catchtouchmove="test">
js:
test:function(){
},
2.catchtouchmove="true"就行了,(个人感觉第二种方法比较简单,好用)
<!-- 首页弹窗 -->
<view class=‘Popup‘ hidden=‘{{bool}}‘ catchtouchmove="true">
评论(0)