微信小程序底部弹窗如何实现,代码是什么
Admin 2022-08-12 群英技术资讯 560 次浏览
本文实例为大家分享了微信小程序实现底部弹窗的具体代码,供大家参考,具体内容如下
xml:
<view bindtap="clickme">点击我可以看到底部弹框的出现</view> <!--屏幕背景变暗的背景 --> <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> <!--弹出框 --> <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"> <!--自定义弹窗内容--> </view>
css:
/*使屏幕变暗 */ .commodity_screen { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; opacity: 0.2; overflow: hidden; z-index: 1000; color: #fff; } /*对话框 */ .commodity_attr_box { height: 50%; width: 100%; overflow: hidden; position: fixed; bottom: 0; left: 0; z-index: 2000; background: #fff; padding-top: 20rpx; }
js:
//点击我显示底部弹出框 clickme: function () { this.showModal(); }, //显示对话框 showModal: function () { // 显示遮罩层 var animation = wx.createAnimation({ duration: 200, timingFunction: "linear", delay: 0 }) this.animation = animation animation.translateY(300).step() this.setData({ animationData: animation.export(), showModalStatus: true }) setTimeout(function () { animation.translateY(0).step() this.setData({ animationData: animation.export() }) }.bind(this), 200) }, //隐藏对话框 hideModal: function () { // 隐藏遮罩层 var animation = wx.createAnimation({ duration: 200, timingFunction: "linear", delay: 0 }) this.animation = animation animation.translateY(300).step() this.setData({ animationData: animation.export(), }) setTimeout(function () { animation.translateY(0).step() this.setData({ animationData: animation.export(), showModalStatus: false }) }.bind(this), 200) },
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
什么是树在现实生活中,相信每个人对树都很熟悉,不管是柳树、杨树还是桃树,可以说树在我们生活中随处可见;在计算机世界,树是一种分层结构的抽象模型,如下图所示:树结构的应用有很多
方法:1、将需要求平均值的数存入数组中;2、使用“for(i=0;i<arr.length;i++){sum+=arr[i]}”语句遍历数组,计算多个数的总和并赋值给变量“sum”;3、使用“sum/arr.length”语句计算出平均值。
1.安装python-software-propertiessudoapt-getinstallpython-software-properties2.添加ppacurl-sLhttps://deb.nodesource.com/setup_8.x|sudo-Ebash-3.安装nodejs和npmsudoapt-getinstallnodejs4.查看
如果调用者在函数返回时能够获得预期结果(即获得预期返回值或看到预期效果),则该函数同步。如果函数同步,即使调用函数执行的任务耗时,也会等到得到预期的结果。
React服务端渲染原理是什么?很多朋友可能听说过React服务端渲染,但是对其原理并不清楚,因此下面小编就给大家介绍一下React服务端渲染原理以及实例,感兴趣的朋友可以参考。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008