欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > 微信开发 > 微信小程序自定义对话框+弹出和隐藏动画详解

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:738

高端HTML5响应式企业通用网

2020-05-06   浏览:519

html5响应式外贸网站英文版

2020-05-08   浏览:506

HTML5自适应律师工作室类网

2020-04-04   浏览:502

HTML5影视传媒文化公司类网

2020-05-12   浏览:496

微信小程序自定义对话框+弹出和隐藏动画详解

发布时间:2021-01-08  
index.js

[javascript] view plain copy

 

 

//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

[java] view plain copy

 

 

<!--index.wxml-->  

<view class="container-column">  

     

本文标签

:备案管家服务帮您把复杂流程变简单,解决您在进行网站备案过程中遇到的效率低下和成功率不高的问题。个人300/2个域名,企业500/5个域名,qq1650004.