新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

微信小程序中如何自定义对话框弹出-创新互联

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

目前创新互联建站已为成百上千的企业提供了网站建设、域名、网络空间、网站托管、企业网站设计、安溪网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

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;
}

以上就是“微信小程序中如何自定义对话框弹出”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注创新互联行业资讯频道。


文章名称:微信小程序中如何自定义对话框弹出-创新互联
标题URL:http://www.wjwzjz.com/article/dddhsi.html
在线咨询
服务热线
服务热线:028-86922220
TOP