From 05bca8682c6c525f3eebf5850e2247bffd4cd95a Mon Sep 17 00:00:00 2001 From: Gcaufy Date: Fri, 19 Jan 2018 15:22:37 +0800 Subject: [PATCH] added page events - https://github.com/Tencent/wepy/issues/793 --- packages/wepy/src/base.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/wepy/src/base.js b/packages/wepy/src/base.js index 751e3d0a8..601681094 100644 --- a/packages/wepy/src/base.js +++ b/packages/wepy/src/base.js @@ -11,7 +11,7 @@ import event from './event'; import util from './util'; -const PAGE_EVENT = ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage']; +const PAGE_EVENT = ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap']; const APP_EVENT = ['onLaunch', 'onShow', 'onHide', 'onError']; @@ -97,6 +97,7 @@ export default { if (!this.$instance) { app.$init(this, appConfig); this.$instance = app; + this.$appConfig = appConfig; } // This is for test case @@ -106,6 +107,9 @@ export default { app.$wxapp = getApp(); + APP_EVENT = APP_EVENT.concat(appConfig.appEvents || []); + PAGE_EVENT = PAGE_EVENT.concat(appConfig.pageEvents || []); + APP_EVENT.forEach((v) => { config[v] = (...args) => { let rst;