apache / incubator-weex

Apache Weex (Incubating)
https://weex.apache.org
Apache License 2.0
13.75k stars 1.82k forks source link

weex-androw(sdk:0.19.0.7):webview message prompt 实现是否错误 #1959

Open zcl0001 opened 5 years ago

zcl0001 commented 5 years ago

com.taobao.weex.ui.view.WXWebView 247行到254行,DOWNGRADE_JS_INTERFACE 逻辑貌似写反了

if (mOnMessageListener != null) { evaluateJS("javascript:(window.postMessage = function(message, targetOrigin) {"

zcl0001 commented 5 years ago

DOWNGRADE_JS_INTERFACE 为false时候 ,android 貌似调用的是web,应该是prompt('" + BRIDGE_NAME + "://postMessage?message=' + JSON.stringify(message) + '&targetOrigin=' + targetOrigin),这样webviewClient 才能拦击,分发消息

zcl0001 commented 5 years ago

向下面这样写,Android端才能收到消息,还有web组件的文档有错误,而且没有说明message事件,多少人都卡在画图上和web组建的消息实现上啊

`<!DOCTYPE html>

ECharts

`

zshshr commented 5 years ago

http://dotwe.org/vue/dcd80a4ce141d639e4b08de86f0bfc27 给个dotwe 例子可以复现的例子

YorkShen commented 5 years ago

辛苦提一个PR,修复文档和DOWNGRADE_JS_INTERFACE的问题,我会来Review