YYPOST群发软件 发表于 4 天前

原生webview的h5如何跟aiwork交互

<span style="color: rgb(52, 58, 64); font-family: &quot;Microsoft Yahei&quot;, 微软雅黑, Tahoma, Arial, Helvetica, STHeiti; font-size: 24px; font-weight: 700; text-align: center;">原生webview的h5如何跟aiwork交互</span><div><div style="text-align: center;"><div class="blockcode" style="overflow: hidden; padding-right: 0px; padding-bottom: 5px; padding-left: 10px; background-image: linear-gradient(90deg, rgb(237, 237, 237), rgb(237, 237, 237)); background-size: 43px; color: rgb(102, 102, 102); zoom: 1;"><blockquote>&lt;!DOCTYPE html&gt;<br>&lt;html lang="en"&gt;<br><br>&lt;head&gt;<br>&lt;meta charset="UTF-8"&gt;<br>&lt;title&gt;合并页面&lt;/title&gt;<br>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;<br>&lt;style&gt;<br>body {<br>background-color: #fff; /* 改为白色 */<br>color: #333; /* 调整文字颜色以匹配白色背景 */<br>font-family: Arial, sans-serif;<br>padding: 20px;<br>}<br><br>.navbar {<br>background-color: #f0f0f0; /* 改为浅色以与白色背景区分 */<br>padding: 10px;<br>display: flex;<br>justify-content: space-around;<br>color: #000;<br>}<br><br>.navbar a {<br>text-decoration: none;<br>color: inherit;<br>font-weight: bold;<br>}<br><br>.section, .submenu {<br>background-color: #fff; /* 改为白色 */<br>color: #333; /* 调整文字颜色 */<br>padding: 20px;<br>margin-bottom: 20px;<br>border-radius: 10px;<br>box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);<br>}<br><br>.section input,<br>.submenu input,<br>input,<br>input,<br>select,<br>button {<br>color: #333; /* 调整文字颜色 */<br>background-color: #ddd; /* 改为浅色 */<br>border: none;<br>border-radius: 5px;<br>padding: 10px;<br>margin-right: 10px;<br>box-sizing: border-box;<br>}<br><br>button {<br>background-color: #4CAF50;<br>width: 60%;<br>font-size: 20px;<br>cursor: pointer;<br>margin-top: 20px;<br>color: #fff; /* 按钮文字颜色 */<br>}<br><br>h1 {<br>color: #e91e63;<br>}<br>&lt;/style&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br>&lt;div class="navbar"&gt;<br>&lt;a href="#"&gt;首页&lt;/a&gt;<br>&lt;a href="#"&gt;话术&lt;/a&gt;<br>&lt;a href="#"&gt;选择平台&lt;/a&gt;<br>&lt;a href="#"&gt;配置&lt;/a&gt;<br>&lt;a href="#"&gt;其他&lt;/a&gt;<br>&lt;/div&gt;<br><br>&lt;h1&gt;合并页面&lt;/h1&gt;<br><br>&lt;div class="section"&gt;<br>&lt;h2&gt;超级延迟&lt;/h2&gt;<br>&lt;input type="checkbox" id="charDelay" name="charDelay"&gt;<br>&lt;label for="charDelay"&gt;按打字数量延迟&lt;/label&gt;<br>&lt;!-- 省略其他选项... --&gt;<br>&lt;/div&gt;<br><br>&lt;div class="submenu"&gt;<br>&lt;h2&gt;招呼设置&lt;/h2&gt;<br>&lt;input type="checkbox" id="fixed-greeting" name="fixed-greeting"&gt;<br>&lt;label for="fixed-greeting"&gt;钉定招呼语---勾选生效&lt;/label&gt;<br>&lt;input type="text" placeholder="请输入招呼1"&gt;<br>&lt;input type="text" placeholder="请输入招呼2"&gt;<br>&lt;input type="text" placeholder="请输入招呼3"&gt;<br>&lt;/div&gt;<br><br>&lt;!-- 省略其他部分... --&gt;<br><br>&lt;form&gt;<br>&lt;div class="section"&gt;<br>&lt;h2&gt;定时&lt;/h2&gt;<br>&lt;input type="checkbox" id="enableTiming" name="enableTiming"&gt;<br>&lt;label for="enableTiming"&gt;开启定时&lt;/label&gt;&lt;br&gt;<br>&lt;!-- 省略其他选项... --&gt;<br>&lt;/div&gt;<br><br>&lt;button type="button" onClick="callHelloAI();"&gt;调用原生方法&lt;/button&gt;<br>&lt;button type="button" onClick="runJS();"&gt;执行脚本代码&lt;/button&gt;<br>&lt;button type="button" onClick="runJsFile();"&gt;执行脚本文件&lt;/button&gt;<br>&lt;button type="button" onClick="sendText();"&gt;传递控件值&lt;/button&gt;<br>&lt;/form&gt;<br><br>&lt;script language="JavaScript"&gt;<br>function callHelloAI() {<br>window.at.callFun('main', 'hello');<br>}<br><br>function runJS() {<br>window.at.runJs(function () {<br>printl("你好");<br>auto.recents();<br>}.toString());<br>}<br><br>function runJsFile() {<br>window.at.runJsFile('主脚本.js');<br>}<br><br>function sendText() {<br>var inputValue = document.getElementById('input1').value;<br>window.at.runJsFile('测试传值.js');<br>}<br>&lt;/script&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br></blockquote></div><br></div><div><div style="text-align: center;"><font color="#343a40" face="Microsoft Yahei, 微软雅黑, Tahoma, Arial, Helvetica, STHeiti"><span style="font-size: 24px;"><b><br></b></span></font></div><div style="text-align: center;"><font color="#343a40" face="Microsoft Yahei, 微软雅黑, Tahoma, Arial, Helvetica, STHeiti"><span style="font-size: 24px;"><b><br></b></span></font></div><p></p><div><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><ignore_js_op></ignore_js_op></p><p></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><ignore_js_op></ignore_js_op></p><br><p></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><a href="http://doc.aiwork24.com:91/server/index.php?s=/api/attachment/visitFile/sign/2d81618b702515969f00d51a5f341f49" title="[原生activity和h5交互案例.zip" style="color: rgb(65, 131, 196); text-decoration-line: none; transition: color 0.08s ease-out 0s; box-sizing: border-box; background: 0px 0px;">原生activity和h5交互案例.zip</a></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">void runJs(function code)h5执行app JS脚本</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJs(<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> (<span class="hljs-params" style="box-sizing: border-box;"></span>)</span>{
   <span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//这里写ATjs代码</span>
   printl(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"你好"</span>);
   auto.home();
}.toString());
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void runJsFile(String file) H5运行APP JS文件</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJsFile(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'主脚本.js'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void callFunction(String funname,String arg) H5执行脚本方法</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.callFun(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'main'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"hello"</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getRootPath() 获取项目根目录</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getRootPath();
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getResourcesPath() 获取项目资源目录</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void setConfig(String path,String arg,String value) 存储数据</span><br style="box-sizing: border-box;">path:存储路径,例如/sdcard/1.txt;<br style="box-sizing: border-box;">arg:参数<br style="box-sizing: border-box;">value:存储值</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.setConfig(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/sdcard/1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//例如存储到资源目录</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">let</span> res=<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.setConfig(res+<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getConfig(String path,String arg,String value) 读取数据</span><br style="box-sizing: border-box;">path:存储路径,例如/sdcard/1.txt;<br style="box-sizing: border-box;">arg:参数<br style="box-sizing: border-box;">value:默认值,没有数据的情况下默认返回</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getConfig(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/sdcard/1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);

<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//从资源目录取数据</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">let</span> res=<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getConfig(res+<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">publicSet(String key,String value) 公共变量传参</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.publicSet(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);

<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//对应aiwork取值就是</span>
publicData.get(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>)
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">publicGet(String key) 公共变量读参</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.publicGet(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>);


<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//对应aiwork写值就是</span>
publicData.set(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>)
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;">完整HTML案例</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-html hljs xml" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-meta" style="box-sizing: border-box; color: rgb(97, 174, 238);">&lt;!DOCTYPE <span class="hljs-meta-keyword" style="box-sizing: border-box;">html</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">html</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">lang</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"en"</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">head</span>&gt;</span>
    <span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">meta</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">charset</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">title</span>&gt;</span>方式一<span class="hljs-tag" style="box-sizing: border-box;">&lt;/<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">title</span>&gt;</span>
    <span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">script</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">language</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"JavaScript"</span>&gt;</span><span class="javascript" style="box-sizing: border-box;">
      <span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> <span class="hljs-title" style="box-sizing: border-box; color: rgb(97, 174, 238);">test</span>(<span class="hljs-params" style="box-sizing: border-box;"></span>) </span>{

         <span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJs(<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> (<span class="hljs-params" style="box-sizing: border-box;"></span>)</span>{
                <span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//这里写js代码</span>
                printl(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"你好"</span>);
         }.toString());

         <span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">/*
         window.at.close();
         window.at.runJsFile('主脚本.js');
          */</span>
      }
    </span><span class="hljs-tag" style="box-sizing: border-box;">&lt;/<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">script</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;/<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">head</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">body</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">input</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">type</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"Button"</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">width</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"300"</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"启动脚本"</span><span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">onClick</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"test()"</span>/&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;/<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">body</span>&gt;</span>
<span class="hljs-tag" style="box-sizing: border-box;">&lt;/<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">html</span>&gt;</span>
</code></pre><h1 id="h1--strong-app-h5-strong-" style="margin-top: 1em; margin-bottom: 1.5em; padding-bottom: 0.3em; box-sizing: border-box; border-bottom: 1px solid rgb(238, 238, 238); position: relative; line-height: 1.75; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif; font-size: 1.8em !important;"><a name="<strong>APP调用H5</strong>:" class="reference-link" style="color: rgb(65, 131, 196); transition: color 0.08s ease-out 0s; font-weight: 400; box-sizing: border-box; background: 0px 0px;"></a><span style="box-sizing: border-box;">APP调用H5</span>:</h1><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">首先获取web控件,例如web控件的自定义ID是web</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//初始化一个activity页面</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">var</span> ac = <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">new</span> activity();
ac.loadXML(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">`
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
&gt;

    &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="H5演示"
      android:textSize="18sp"
      android:textStyle="bold"
      android:gravity="center"
      android:paddingBottom="8dp" /&gt;

    &lt;WebView
      android:id="@+id/web"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1" /&gt;

&lt;/LinearLayout&gt;
`</span>)

sleep.millisecond(毫秒 = <span class="hljs-number" style="box-sizing: border-box; color: rgb(209, 154, 102);">400</span>);

<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">var</span> web1 = ac.findWebViewById(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'web'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">加载网址</span>loadUrl(url)</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><span class="btn-pre-copy" style="box-sizing: border-box; display: block; user-select: none; position: absolute; top: 10px; right: 12px; font-size: 11px; line-height: 1; cursor: pointer; color: rgb(153, 153, 153); transition: color 0.1s ease 0s;">复制</span><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;">web1.url(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/代码/h5.html'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, &quot;Helvetica Neue&quot;, &quot;Droid Sans&quot;, &quot;wenquanyi micro hei&quot;, FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;">执行h5的js方法,注意代码事字符串http://bbs.aiwork24.com/thread-124-1-1.html<br style="box-sizing: border-box;">String runWebJs(String jscode)<br style="box-sizing: border-box;">返回值:类似js中eval执行js代码的返回值,一般是返回最后一个变量的值http://www.postbbs.com/thread-2894-1-1.html</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: &quot;YaHei Consolas Hybrid&quot;, Consolas, &quot;Meiryo UI&quot;, &quot;Malgun Gothic&quot;, &quot;Segoe UI&quot;, &quot;Trebuchet MS&quot;, Helvetica, monospace, monospace; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//让浏览器运行js代码</span>
web1.runWebJs(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">`alert("123")`</span>);</code></pre></div></div></div><p></p>
页: [1]
查看完整版本: 原生webview的h5如何跟aiwork交互