当前位置:网站首页>uni-app进阶之内嵌应用【day14】
uni-app进阶之内嵌应用【day14】
2022-07-22 22:05:00 【华为云】

如今,各大app平台都有自己的小程序系统,各种应用可以直接嵌入app中,实现一站式体验。使用uniapp开发的应用程序如何实现这样的功能?答案是嵌入式web视图。
获取android页面中的中的webView嵌入H5页面。
WebView webView = findViewById(R.id.webView_h5);//webView.loadUrl("http://127.0.0.1/asset/pages/forAndroidAndH5.html");//嵌入H5页面添加辅助处理JS,否则一些JS函数会失败,如alert()方法
webView.setWebChromeClient(new WebChromeClient(){ public boolean onJsAlert(WebView view, String url, String message, JsResult result){ return super.onJsAlert(view, url, message, result); }});每个Vue页面实际上都是一个WebView,Vue页面中的web视图组件实际上是WebView中的一个子WebView。子WebView附加到父WebView。
Vue页面将自动覆盖整个页面,并使用@消息接收web视图页面通信;
Nvue页面需要指定页面宽度和高度,使用@onpostmessage接收web视图页面通信;
app Vue中的web视图组件不支持自定义样式,但v-show的本质是更改组件样式。也就是说,该组件支持V-IF而不是V-show。
默认情况下,<web view>组件是全屏的,并且高于前端组件。应用程序端需要使用plus规范来调整大小或覆盖其上的内容。
H5端的web视图实际上使用当前浏览器转换为iframe;
应用程序端IOS分为uiwebview和wkwebview。自2.2.5版本起,默认为wkwebview;
Nvue web视图必须指定样式宽度和高度;
应用程序网页向应用程序发送实时消息;
默认情况下,App nvue web视图没有大小。可以按样式设置大小。如果要填充整个窗口,可以将flex设置为:
1。标题栏不会在web视图页面中自动显示标题。如果要填充整个窗口并显示标题,建议使用Vue页面的web视图(无法控制默认全屏),如果要自定义web视图的大小,请使用nvue web视图;
如果参数是字符串,则需要“单引号”。如果参数是数值,则不需要该参数。如果没有参数,只需留下一个()
使用无/无参数和返回值调用JS函数
int arg1 = 10;int arg2 = 12;String methodH5 = "androidtoh5WithResult(" + arg1 + "," + arg2 + ")";webView.evaluateJavascript(methodH5, new ValueCallback<String>() { @Override public void onReceiveValue(String s) { System.out.println("=====s:" + s); }});边栏推荐
- 这不是真正意义上的元宇宙,元宇宙应当具备自身鲜明的特质和独特的发展逻辑
- Restclient operation index library - initialize restclient
- RestClient操作索引库-初始化RestClient
- RN underlying principle -- 1. Component and purecomponent analysis
- How to use selenium.chrome to realize the extended function of intercepting or forwarding requests
- [reading notes > statistics] 12-01 construction of confidence interval - Introduction to the concept of confidence interval
- 直播预告 | 开源安全治理模型和工具直播研讨会
- It can't be true? Nailing has been downloaded. Don't you know you can play like this?
- How to open the file in keil is the real path in the 109th blog of fledgling Xiao Li
- C language minesweeping
猜你喜欢

Qt+VTK+PCL图片转灰度图且以灰度为Y轴显示

Spark疑难杂症排查-Premature EOF: no length prefix available

There are 13 detailed methods for JMeter to view the response of the result tree!

Mysql A left(right) join B on A.id=B. ID and a.age=1 and a left (right) join b on a.id=b id where A.age=1

MSG | 开源与结缘,昇思携梦前行!
![Reading notes - > statistics] construction of 12-02 confidence interval -t distribution concept introduction](/img/4d/25b4d3d6af0fb30c222613d3c428b7.png)
Reading notes - > statistics] construction of 12-02 confidence interval -t distribution concept introduction

张宇高数30讲总结

@Transactional事务方法中包含多个同类事务方法,这些事务方法本身设置失效两种解决方案

Learn these SketchUp skills and improve work efficiency by half

老板要我做一个 IP 属地功能,一个开源库搞定!
随机推荐
剑指Offer | 旋转数组的最小数字
初出茅庐的小李第108篇博客二进制打印
Rust——关于Option详解
如何高效安装MindSpore的GPU版本
LeetCode 第26天
matlab simulink 磷酸铁锂电池仿真
Talking about performance optimization: analysis and optimization of APP startup process
networkx对图进行可视化
@Transactional事务方法中包含多个同类事务方法,这些事务方法本身设置失效两种解决方案
Google Earth Engine APP——一个完整的地图图例APP(美国西部土地利用分类)
pip更新一个package
改变this指向了解一下
pycharm中使用私钥远程连接服务器
C#中C/S端如何实现WebService服务
如何用C语言实现简单职工信息管理系统
93.(leaflet篇)leaflet态势标绘-进攻方向修改
技术干货 | 基于MindSpore详解Perplexity语言模型评价指标
张宇高数30讲总结
PostgreSQL database master-slave deployment master database suspended restore master database
How to open the file in keil is the real path in the 109th blog of fledgling Xiao Li