微信小程序实现弹框效果微信小程序实现弹框效果
主要为大家详细介绍了微信小程序实现弹框效果,文中示例代码介绍的非常详细,具有一定的参考价值,感兴
趣的小伙伴们可以参考一下
本文实例为大家分享了微信小程序实现弹框效果的具体代码,供大家参考,具体内容如下
先上代码
wxml部分:
<view class='top' bindtap='powerDrawer' data-statu="open" data-num='300'>
<text>向上弹起</text>
</view>
<view class='top' bindtap='powerDrawer' data-statu="open" data-num='-300'>
<text>向下弹出</text>
</view>
<!--遮罩部分-->
<view class="drawer_screen" wx:if="{{showModalStatus}}" bindtap="powerDrawer" data-statu="close"></view>
<!--弹出层内容-->
<!--使用animation属性指定需要执行的动画-->
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus}}">
<view class='modalBox'>
<view class='modalQues'>是否退出?</view>
<view class='modalConf'>是否确定退出</view>
<view class='hidePick'>
<text bindtap="powerDrawer" data-statu="close" class='hideModal' >确定</text>
<text bindtap="powerDrawer" data-statu="close" class='hideModal' >取消</text>
</view>
</view>
</view>
wxss部分:
.top {
margin: 0 auto;
margin-top: 50rpx;
background: #1da0ee;
color: #fff;
width: 50vw;
text-align: center
}
.drawer_screen {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
background: #000;
opacity: 0.5;
overflow: hidden;
}
/*content*/
.drawer_box {
width:600rpx;
height:300rpx;
overflow:hidden;
position:fixed;
top:50%;
left:50%;
z-index:1001;
background:#FAFAFA;
margin-top:-150rpx;
border-radius:3px;
margin-left:-300rpx;
}
.modalBox {
padding: 60rpx;
font-size: 30rpx;
}
评论0