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;
})回调就不执行了 求救 展开