Page({
data: {
shows: false,
},
clickMe: function () {
this.setData({
shows: true,
})
},
close: function () {
this.setData({
shows: false,
})
},
})
<view class="box">
<view class="boxContent">
<text class="boxTitle">这是一个遮罩</text>
<button class="btn" type="warn" catchtap="clickMe">点我</button>
</view>
<view class="shade" wx:if="{
{shows}}" bindtap='close'></view>
<view class="boxDailog" wx:if="{
{shows}}">
<text class="tit">这是一个弹窗</text>
</view>
</view>
.box{
width: 100%;
height: 100%;
}
.boxTitle{
font-size: 30rpx;
}
.btn{
font-size: 30rpx;
}
.shade{
width: 100%;