做小程序項(xiang)目遇到一(yi)個項(xiang)目,就是點一(yi)個按鈕出(chu)現一(yi)個蒙層,然而下面的頁面還是可(ke)以滾動(dong),解決如(ru)下: view bindtap="hideCoupon" class='coupon_receive_wrapper {{showCouponFlag==true?"active":""}}' catchtouchmov ...
<view bindtap="hideCoupon" class='coupon_receive_wrapper {{showCouponFlag==true?"active":""}}' catchtouchmove="preventD">
樣(yang)式如(ru)下 :
.coupon_receive_wrapper{
display:none;
position:fixed;
left:0;
top:0;
right:0;
bottom:0;
width:100%;
height:100%;
background:rgba(0,0,0,.5);
z-index:11;
transition: all 1s ease;
}
.coupon_receive_wrapper.active{
display:block;
}
給蒙(meng)層那(nei)個元(yuan)素加個touchmove事(shi)件(jian),這個事(shi)件(jian)用來阻止事(shi)件(jian)冒(mao)泡,preventD中的代碼(ma)如下:preventD(){}問(wen)題(ti)就解決了。