// components/pop/pop.js Component({ /** * 组件的属性列表 */ properties: { show: { type: Boolean, value: false } }, observers: { 'show': function (show) { let that = this if (show) { that.open() } else { that.close() } } }, /** * 组件的初始数据 */ data: { showPop: false, animation: "" }, /** * 组件的方法列表 */ methods: { none() { return }, open() { let that = this that.setData({ showPop: true }) setTimeout(() => { that.setData({ animation: "active" }) }, 50); }, close() { let that = this that.setData({ animation: "" }) setTimeout(() => { that.setData({ showPop: false }) }, 350); }, closeEvent() { let that = this that.triggerEvent('close', false) } } })