话不多说 上代码。
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="/UploadFiles/2021-04-02/tripDetailAlertHide.png">
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 }) }, })总结
以上所述是小编给大家介绍的微信小程序实现蒙版弹出窗功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
最新资源
- 【中国民乐】张维良《秋江夜泊》2004[FLAC+CUE]
- 明达年度发烧碟MasterSuperiorAudiophile2011[D
- 明达年度发烧碟MasterSuperiorAudiophile2017[D
- 翁立友.2008-恨孤单【大旗】【WAV+CUE】
- 群星.2009-Magic.Cover日粤精华3CD【环球】【WA
- 华少翌.2005-华少翌【中唱艺能】【WAV+CUE】
- 群星《十二女声Ⅱ》[WAV/CUE/分轨][527MB]
- 大自然音乐系列《漫步在山裡》[WAV/CUE/分轨][5
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453
- 史依弘《史依弘交响乐京剧演唱专辑HQ》头版限量