Component({ /** * 组件的属性列表 */ properties: { show: { type: Boolean, observer: 'show' }, showHeight: { type: Number, value: -68 } }, /** * 组件的初始数据 */ data: { hidden: true, animation: {} }, /** * 组件的方法列表 */ methods: { call: function (sender) { this.hidden() wx.makePhoneCall({ phoneNumber: '02028834746', }) }, cancel: function (sender) { this.hidden() }, hidden: function () { var animation = wx.createAnimation({ duration: 300, timingFunction: 'ease', }) animation.bottom('-532rpx').step() this.setData({ animation: animation.export() }) setTimeout(function () { this.data.show = false this.data.hidden = true this.setData({ hidden: this.data.hidden }) this.triggerEvent('hiddenContact', {}, {}) }.bind(this), 300) }, show: function () { if (!this.data.hidden) { return } this.data.hidden = false this.setData({ hidden: this.data.hidden }) setTimeout(function () { var animation = wx.createAnimation({ duration: 300, timingFunction: 'ease', }) var bottom = this.data.showHeight + 'rpx' animation.bottom(bottom).step() this.setData({ animation: animation.export(), }) }.bind(this), 100) }, } })