diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 5b961219275d422aac739faae2b78ad4fdbc36f7..2d5e690df74c3b8442434497dfd1808225e1a3e8 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1697,6 +1697,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && wx.onAppShow) { + wx.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && wx.onAppHide) { + wx.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 385651a95930f392ad727799193731361a121640..d55d44278001f690545f68d077eb4d6ff782c6c9 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -2610,6 +2610,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && my.onAppShow) { + my.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && my.onAppHide) { + my.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = my.getLaunchOptionsSync && my.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index aa2e12f5abfb9dac619b570e5c8a08016eec86da..58ea34ca35526b7a9fea9426db88e95596a97b48 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -2096,6 +2096,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && swan.onAppShow) { + swan.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && swan.onAppHide) { + swan.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = swan.getLaunchOptionsSync && swan.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-kuaishou/dist/index.js b/packages/uni-mp-kuaishou/dist/index.js index 1cb71dc7969a4c411ff2fac8960c979dbdb37657..e7922ce875a472431ac46095ffc0de0372f870c4 100644 --- a/packages/uni-mp-kuaishou/dist/index.js +++ b/packages/uni-mp-kuaishou/dist/index.js @@ -1754,6 +1754,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && ks.onAppShow) { + ks.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && ks.onAppHide) { + ks.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = ks.getLaunchOptionsSync && ks.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 0164afe54989171db143f0e447518bae5eb0b371..d916a5b67d5d7a878a3ac144ecf012e0dab7e226 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1927,6 +1927,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && wx.onAppShow) { + wx.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && wx.onAppHide) { + wx.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 0e3af41ab1b9f30022505c62ec4bc165f6c345d3..b5e8d1142c7dc0176e1497011c3ea66a4253f6c4 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -2135,6 +2135,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && tt.onAppShow) { + tt.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && tt.onAppHide) { + tt.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = tt.getLaunchOptionsSync && tt.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index f8735619c94cdbfb02f9a5f7cb4d7570d5921e67..caba32a3b319b172721172284aed453b28ab062a 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1679,6 +1679,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && wx.onAppShow) { + wx.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && wx.onAppHide) { + wx.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/packages/uni-quickapp-webview/dist/index.js b/packages/uni-quickapp-webview/dist/index.js index 0e6b4aa59fa986d7c2d9d6f67b88c4acad6b6937..11f0f53d9f23d677e93f8470a2dad91b99edd989 100644 --- a/packages/uni-quickapp-webview/dist/index.js +++ b/packages/uni-quickapp-webview/dist/index.js @@ -1845,6 +1845,20 @@ function createSubpackageApp (vm) { app[name] = appOptions[name]; } }); + if (isFn(appOptions.onShow) && qa.onAppShow) { + qa.onAppShow((...args) => { + appOptions.onShow.apply(app, args); + }); + } + if (isFn(appOptions.onHide) && qa.onAppHide) { + qa.onAppHide((...args) => { + appOptions.onHide.apply(app, args); + }); + } + if (isFn(appOptions.onLaunch)) { + const args = qa.getLaunchOptionsSync && qa.getLaunchOptionsSync(); + appOptions.onLaunch.call(app, args); + } return vm } diff --git a/src/core/runtime/wrapper/create-subpackage-app.js b/src/core/runtime/wrapper/create-subpackage-app.js index c2a3c74b8b003e0bd3e3af23432c9c90aadece9c..855b32ca3c7e147b82fe0842c11743706e335570 100644 --- a/src/core/runtime/wrapper/create-subpackage-app.js +++ b/src/core/runtime/wrapper/create-subpackage-app.js @@ -1,6 +1,7 @@ import 'uni-platform/runtime/index' import { + isFn, hasOwn } from 'uni-shared' @@ -24,5 +25,19 @@ export default function createSubpackageApp (vm) { app[name] = appOptions[name] } }) + if (isFn(appOptions.onShow) && __GLOBAL__.onAppShow) { + __GLOBAL__.onAppShow((...args) => { + appOptions.onShow.apply(app, args) + }) + } + if (isFn(appOptions.onHide) && __GLOBAL__.onAppHide) { + __GLOBAL__.onAppHide((...args) => { + appOptions.onHide.apply(app, args) + }) + } + if (isFn(appOptions.onLaunch)) { + const args = __GLOBAL__.getLaunchOptionsSync && __GLOBAL__.getLaunchOptionsSync() + appOptions.onLaunch.call(app, args) + } return vm }