按照这位友友的方法离线打包,java层向js层传值异常尝试写了安卓向js传值,代码如下:
java层(放在专门和h5交互的类中,sdk导入的是dcloud的包)
private static void IResule(String msg){
ArrayList<IWebview> weblist = SDK.obtainAllIWebview();
DebugLogs.e("weblist:"+weblist.size());
for (int i = 0; i < weblist.size(); i++) {
DebugLogs.e("web:"+weblist.get(i).getOriginalUrl());
if (weblist.get(i).getOriginalUrl().contains("set.html")) {
weblist.get(i).executeScript(
"javascript:receiveResult(" + msg+ ")");
}
}
}
js层(尝试放在plusready内外都没有反应)
var receiveResult = function(msg) {
document.getElementById("demo1").classList.add("mui-hidden");
mui.toast(msg);
};
不知道是哪里出了问题,急求大神解答
0 个回复