当前位置: 首页 > 工具软件 > bridge. > 使用案例 >

android调用js中的回调方法无效,js调用IOS方法 bridge.callHandler 里面的回调函数不执行...

李开宇
2023-12-01

js调用IOS方法 bridge.callHandler 里面的回调函数不执行0

functionsetupWebViewJavascriptBridge(callback){if(window.WebViewJavascriptBridge){returncallback(WebViewJavascriptBridge);}if(window.WVJBCallbacks){returnwindow.WVJBCallb... function setupWebViewJavascriptBridge(callback) {

if (window.WebViewJavascriptBridge) {

return callback(WebViewJavascriptBridge);

}

if (window.WVJBCallbacks) {

return window.WVJBCallbacks.push(callback);

}

window.WVJBCallbacks = [callback];

var WVJBIframe = document.createElement('iframe');

WVJBIframe.style.display = 'none';

WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';

document.documentElement.appendChild(WVJBIframe);

setTimeout(function () {

document.documentElement.removeChild(WVJBIframe)

}, 0)

}

setupWebViewJavascriptBridge(function (bridge) {

bridge.callHandler('getToken', "",function (data) {

alert(data)

window.sessionStorage.setItem('token',data.token);

Login.ajaxtoken = data.token;

})

})

一到 bridge.callHandler('getToken', "",function (data) {

alert(data)

window.sessionStorage.setItem('token',data.token);

Login.ajaxtoken = data.token;

})回调就不执行了 求救 展开

 类似资料: