提交 203cfbd0 编写于 作者: fxy060608's avatar fxy060608

feat(v3): onWebInvokeApi

上级 a82f15fa
...@@ -15,3 +15,4 @@ export const WEBVIEW_READY = 'webviewReady' ...@@ -15,3 +15,4 @@ export const WEBVIEW_READY = 'webviewReady'
export const WEBVIEW_UI_EVENT = 'webviewUIEvent' export const WEBVIEW_UI_EVENT = 'webviewUIEvent'
export const VD_SYNC_CALLBACK = 'vdSyncCallback' export const VD_SYNC_CALLBACK = 'vdSyncCallback'
export const INVOKE_API = 'invokeApi' export const INVOKE_API = 'invokeApi'
export const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'
...@@ -4,7 +4,8 @@ import { ...@@ -4,7 +4,8 @@ import {
VD_SYNC, VD_SYNC,
VD_SYNC_CALLBACK, VD_SYNC_CALLBACK,
INVOKE_API, INVOKE_API,
WEBVIEW_READY WEBVIEW_READY,
WEB_INVOKE_APPSERVICE
} from '../../../constants' } from '../../../constants'
import { import {
...@@ -16,7 +17,8 @@ import onWebviewReady from './on-webview-ready' ...@@ -16,7 +17,8 @@ import onWebviewReady from './on-webview-ready'
import onVdSync from './on-vd-sync' import onVdSync from './on-vd-sync'
import onVdSyncCallback from './on-vd-sync-callback' import onVdSyncCallback from './on-vd-sync-callback'
import onInvokeApi from './on-invoke-api' import onInvokeApi from './on-invoke-api'
import onWebInvokeApi from './on-web-invoke-api'
export function initSubscribeHandlers () { export function initSubscribeHandlers () {
const { const {
...@@ -34,6 +36,8 @@ export function initSubscribeHandlers () { ...@@ -34,6 +36,8 @@ export function initSubscribeHandlers () {
subscribeHandler(data.type, data.data, data.pageId) subscribeHandler(data.type, data.data, data.pageId)
}) })
registerPlusMessage(WEB_INVOKE_APPSERVICE, onWebInvokeApi)
subscribe(WEBVIEW_READY, onWebviewReady) subscribe(WEBVIEW_READY, onWebviewReady)
const entryPagePath = '/' + __uniConfig.entryPagePath const entryPagePath = '/' + __uniConfig.entryPagePath
......
export default function onInvokeApi (data) {
// TODO
console.log('onInvokeApi', data)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册