要实现: 1. 页面上通过修改data显示自定义组件,2. 自定义组件内添加事件隐藏组件实例;
显示组件的动画不知道添加在哪里;
自定义组件内添加事件隐藏组件实例,脚本如下,效果不对
__hideModal: function () { var mask_animation = wx.createAnimation(), modal_animation = wx.createAnimation(); mask_animation.opacity(1).step(); modal_animation.opacity(1).scale(1).step(); this.setData({ __maskAni: mask_animation.export(), __modalAni: modal_animation.export() }); setTimeout(function(){ mask_animation.opacity(0).step(); modal_animation.opacity(0).scale(.5).step(); this.setData({ __maskAni: mask_animation.export(), __modalAni: modal_animation.export(), showModal: false }) }.bind(this), 1000) }, __cancel: function() { this.__hideModal(); this.triggerEvent('cancel'); },
|
< view animation = "{{__maskAni}}" class = "modal_mask" bindtap = "__cancel" wx:if = "{{showMask && showModal}}" > |
求解