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 }