diff --git a/pages/index/index.js b/pages/index/index.js index 633cebd..22e30f5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -29,7 +29,7 @@ Scene({ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() }) - // event.on('TabMessage', this, this.onEvent) + event.on('EventMessage', this, this.onEvent) this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight), safeBottom: app.globalData.safeBottom }) this.data.setInter = setInterval(this.fetchMessage, 10000) }, @@ -48,7 +48,8 @@ Scene({ return false }, onEvent: function (message) { - if (message.what == 99) { + if (message.what == 888) { + this.onUnload() } }, fetchMessage: function(){ @@ -67,6 +68,7 @@ Scene({ this.setData({zIndex: detail}) }, onUnload: function(){ + event.remove('EventMessage', this) if(this.data.setInter) { clearInterval(this.data.setInter) this.data.setInter = null