
小程序图片点击全屏.gif
话不多说 上代码。
wxml:
<view class="page"> <button bindtap="showMask"> 弹出 </button> <view catchtouchmove="preventTouchMove" class="alert-mask" wx:if="{{showModal}}"></view> <view class="modalDlg" wx:if="{{showModal}}"> <view class="modelTitle">我是标题</view> <view class="modeContent"> 我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容 </view> <image class="hide-btn" bindtap="hideMask" src="./../images/tripDetailAlertHide.png"></image> </view></view>
wxss:
/* 弹窗蒙版 start */.alert-mask { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; z-index: 9000; opacity: 0.7;}.modalDlg { width: 80%; height: 55%; position: fixed; top: 45%; left: -1%; z-index: 9999; box-sizing: border-box; padding: 25rpx; margin: -370rpx 85rpx; background-color: #fff; border-radius: 18rpx; display: flex; flex-direction: column; align-items: center;}.modelTitle{ font-size: 38rpx; margin-bottom: 20rpx;}.hide-btn { position: absolute; top: 10rpx; right: 10rpx; width: 50rpx; height: 50rpx;}/* 弹窗蒙版 end*/
js:
Page({ data: { showModal: false }, onLoad(o) { }, showMask: function () { this.setData({ showModal: true }) }, hideMask: function () { this.setData({ showModal: false }) },})
文章转载于:https://www.jianshu.com/p/68dd5f80c111
原著是一个有趣的人,若有侵权,请通知删除
还没有人抢沙发呢~