自定义弹窗

<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>

<view class="modalDlg" wx:if="{{showModal}}">
<image src="/figures/logo-smile.png"/>
<text>欢迎来到模态对话框~</text>
<button bindtap="go">关掉对话框</button>
</view>

<button bindtap="submit">弹窗</button>


.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.7;
}

.modalDlg{
width: 580rpx;
height: 620rpx;
position: fixed;
top: 50%;
left: 0;
z-index: 9999;
margin: -370rpx 85rpx;
background-color: #fff;
border-radius: 36rpx;
display: flex;
flex-direction: column;
align-items: center;
}

Page({

data: {
showModal: false
},

submit: function() {
this.setData({
showModal: true
})
},

preventTouchMove: function() {

},


go: function() {
this.setData({
showModal: false
})
}

})

猜你喜欢

转载自www.cnblogs.com/zcy1995/p/9361556.html