使用flutter_webview_plugin插件通过javascript模拟“ Enter”事件

问题描述

我正在Flutter中使用插件Flutter_webview_plugin:^ 0.3.11”创建一个应用程序,以运行Web应用程序。 我在填写该字段后尝试模拟“ Enter”事件。 我设法完成了在浏览器(Chrome和Firefox)中所需的操作,但该应用程序无法正常工作。

我正在这样做,如下:

String codigoLido = '20000000000000000004622325';

String comando = '''var input = document.getElementById(document.activeElement.id);
                    input.value = "'''+ codigoLido +'''";
                    input.dispatchEvent(new KeyboardEvent("keypress",{
                                                              bubbles: true,cancelable: true,keyCode: 13,key: 13,which: 13
                                                           })
                    );''';
final future = FlutterWebViewPlugin.evalJavascript(comando);

该字段正确填写,但不会发生“ Enter”事件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)