diff --git a/src/core/service/bridge/on.js b/src/core/service/bridge/on.js index 0c0cabe77a5ce1ca3944283ffb0bca934eaa6bc6..cf99847dfaf6b0490393ac42193db6cb00c59e6d 100644 --- a/src/core/service/bridge/on.js +++ b/src/core/service/bridge/on.js @@ -46,6 +46,17 @@ function onAppEnterForeground () { callCurrentPageHook('onShow') } +function onWebInvokeAppService ({ + name, + arg +}, pageId) { + if (name === 'postMessage') { + // TODO 小程序后退、组件销毁、分享时通知 + } else { + uni[name](arg) + } +} + export default function initOn (on) { on('onError', onError) on('onPageNotFound', onPageNotFound) @@ -57,4 +68,6 @@ export default function initOn (on) { on('onTabItemTap', createCallCurrentPageHook('onTabItemTap')) on('onNavigationBarButtonTap', createCallCurrentPageHook('onNavigationBarButtonTap')) + + on('onWebInvokeAppService', onWebInvokeAppService) } diff --git a/src/platforms/h5/components/app/index.vue b/src/platforms/h5/components/app/index.vue index 7e9c227f6517b659e038920bd082994b30b89f4b..21b444ca231c2cf9a073bd21d8bce9f1f13358b2 100644 --- a/src/platforms/h5/components/app/index.vue +++ b/src/platforms/h5/components/app/index.vue @@ -6,25 +6,29 @@ - - - - - +