码迷,mamicode.com
首页 > 其他好文 > 详细

小程序开发 模态弹出框的控制

时间:2017-10-08 11:21:07      阅读:910      评论:0      收藏:0      [点我收藏+]

标签:btn   time   set   modal   targe   程序   oda   ima   func   

// 模态框控制弹出按钮
<view class=‘btn-right-btn flexca‘ bindtap="setModalStatus" data-status="1">立即抢拼</view>
 
//模态弹出框外包裹
<view class=‘add-rob‘ bindtap="setModalStatus" data-status="0" wx:if="{{showModalStatus}}">
 
JS函数 
//-----------------------------------------
// 弹窗
setModalStatus: function (e) {
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})

this.animation = animation
animation.translateY(300).step();

this.setData({
animationData: animation.export()
})

if (e.currentTarget.dataset.status == 1) {

this.setData(
{
showModalStatus: true
}
);
}
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation
})
if (e.currentTarget.dataset.status == 0) {
this.setData(
{
showModalStatus: false
}
);
}
}.bind(this), 200)
},

小程序开发 模态弹出框的控制

标签:btn   time   set   modal   targe   程序   oda   ima   func   

原文地址:http://www.cnblogs.com/dianzan/p/7636629.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!