openwebf / webf

Build flutter apps with HTML/CSS and JavaScript.
https://openwebf.com/
Apache License 2.0
1.49k stars 105 forks source link

根据文档在dart中执行js函数,无响应 #612

Closed dunkong closed 1 month ago

dunkong commented 1 month ago

Affected version

0.16.0

No same issues found

Bug type

Others

Which frontend framework you are using.

未使用框架

Steps to reproduce

dart中通过javaScriptChannel.invokeMethod('testJs', '1234545');调用的函数,且已在WebF(controller: widget.controller,javaScriptChannel: javaScriptChannel)配置。 js中直接通过下列函数接收 <script> webf.methodChannel.addMethodCallHandler('testJs', function(state) { console.log('这是测试页面'); }); </script> 但是并未产生任何反应,是需要做什么其他的处理吗

Code example

No response

Expected results

dart中成功执行js里面的方法

Actual results

dart中未能成功执行js里面的方法