100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 自定义小程序popupwindow弹出框

自定义小程序popupwindow弹出框

时间:2022-03-26 16:51:11

相关推荐

自定义小程序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});},})

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。