微信小程序底部弹窗如何实现,代码是什么
Admin 2022-08-12 群英技术资讯 1081 次浏览
这篇文章主要讲解了“微信小程序底部弹窗如何实现,代码是什么”,文中的讲解内容简单、清晰、详细,对大家学习或是工作可能会有一定的帮助,希望大家阅读完这篇文章能有所收获。下面就请大家跟着小编的思路一起来学习一下吧。本文实例为大家分享了微信小程序实现底部弹窗的具体代码,供大家参考,具体内容如下

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进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
node.js导致进程退出是什么原因?NodeJS进程推出的因素通常是主动退出、未捕获的异常、未处理的 promise rejection、未处理的 Event Emitter error 事件和系统信号这三种,接下来我们详细了解看看。
JavaScript的保留字是什么意思,有哪些?javascript的保留字有:abstract、double、goto、native、static等等,很多新手不清楚JavaScript的保留字是什么,对此本文就给大家来简单的介绍一下,大家在使用JavaScript时,对于JavaScript的保留字要注意。
最近小编接到一个项目pc端和移动端是两个独立的项目,两个项目项目中的内容基本相同,链接组合的方式都有规律可循,接到的需求便是在移动端访问pc端的URL连接时,重定向至移动端对应页面,下面小编给大家分享实现过程,一起看看吧
本文主要介绍的是vue项目中怎么样追踪数据变化的内容,下文有具体的实现代码及方法,对大家学习和工作都有一定的参考价值,需要的朋友可以了解看看。
隐藏边框线的方法:1、使用“document.getElementById("id")”语法根据id值获取指定元素节点;2、使用“元素节点.style.borderColor="transparent";”语句来隐藏指定元素节点的边框线。
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008