您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

小程序popupwindow弹出框的实现代码

2025/4/3 1:25:03发布29次查看
本篇文章给大家带来的内容是关于小程序popupwindow弹出框的实现代码,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
在上方弹出
wxml
<view class="zan-dialog {{ showdialog ? 'zan-dialog--show' : '' }}"> <view class="zan-dialog__mask" bindtap="toggledialog" /> <view class="zan-dialog__container"> <view style="padding: 100px 0; text-align: center;">dialog内容</view> </view></view>
wcss
.zan-dialog__mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(0, 0, 0, 0.4); display: none; }.zan-dialog__container { position: fixed; top: 0; width: 750rpx; background: white; transform: translatey(-150%); transition: all 0.4s ease; z-index: 12; }.zan-dialog--show .zan-dialog__container { transform: translatey(0); }.zan-dialog--show .zan-dialog__mask { display: block; }
js
page({ data: { showdialog: false },//控制 pop 的打开关闭 toggledialog() { this.setdata({ showdialog: !this.data.showdialog }); },})

在下方弹出wxml
<view class="zan-dialog {{ showdialog ? 'zan-dialog--show' : '' }}"> <view class="zan-dialog__mask" bindtap="toggledialog" /> <view class="zan-dialog__container"> <view style="padding: 100px 0; text-align: center;">dialog内容</view> </view> </view>
wcss
.zan-dialog__mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(0, 0, 0, 0.4); display: none; }.zan-dialog__container { position: fixed; bottom: 0; width: 750rpx; background: white; transform: translatey(150%); transition: all 0.4s ease; z-index: 12; }.zan-dialog--show .zan-dialog__container { transform: translatey(0); }.zan-dialog--show .zan-dialog__mask { display: block; }
js
page({ data: { showdialog: false },//控制 pop 的打开关闭 toggledialog() { this.setdata({ showdialog: !this.data.showdialog }); },})

相关推荐:
在微信小程序里添加弹出对话框
微信小程序使用modal组件弹出对话框实例分享
以上就是小程序popupwindow弹出框的实现代码的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product