微信小程序中如何自定义对话框弹出-创新互联
今天小编给大家分享一下微信小程序中如何自定义对话框弹出的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

index.js
//index.js
var app = getApp();
let animationShowHeight = 300;
Page({
data:{
animationData:"",
showModalStatus:false,
imageHeight:0,
imageWidth:0
},
imageLoad: function (e) {
this.setData({imageHeight:e.detail.height,imageWidth:e.detail.width});
},
showModal: function () {
// 显示遮罩层
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})
this.animation = animation
animation.translateY(animationShowHeight).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(animationShowHeight).step()
this.setData({
animationData: animation.export(),
})
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation.export(),
showModalStatus: false
})
}.bind(this), 200)
},
onShow:function(){
let that = this;
wx.getSystemInfo({
success: function(res) {
animationShowHeight = res.windowHeight;
}
})
},
})index.wxml
{{item}}
index.wxss
.buydes-dialog-container{
width: 100%;
height: 100%;
justify-content: space-between;
background-color:rgba(15, 15, 26, 0.7);
position: fixed;
z-index: 999;
}
.buydes-dialog-container-top{
flex-grow: 1;
}
.buydes-dialog-container-bottom{
display: flex;
flex-grow: 0;
}
.buydes-dialog-container-bottom-item{
padding:24rpx;
display: flex;
justify-content: center;
border-bottom: 1rpx solid #eeeeee;
}以上就是“微信小程序中如何自定义对话框弹出”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注创新互联行业资讯频道。
当前文章:微信小程序中如何自定义对话框弹出-创新互联
本文链接:http://www.jxjierui.cn/article/dddhsi.html


咨询
建站咨询
