当前位置:网站首页>Advanced embedded application of uni app [day14]
Advanced embedded application of uni app [day14]
2022-06-30 18:11:00 【Hua Weiyun】

Now , The major app Each platform has its own applet system , Various applications can be directly embedded app in , Achieve a one-stop experience . Use uniapp How can the developed application realize such a function ? The answer is embedded web View .
obtain android Of pages webView The embedded H5 page .
WebView webView = findViewById(R.id.webView_h5);//webView.loadUrl("http://127.0.0.1/asset/pages/forAndroidAndH5.html");// The embedded H5 page Add auxiliary processing JS, Otherwise some JS The function fails , Such as alert() Method
webView.setWebChromeClient(new WebChromeClient(){ public boolean onJsAlert(WebView view, String url, String message, JsResult result){ return super.onJsAlert(view, url, message, result); }}); Every Vue The page is actually a WebView,Vue On the page web The view component is actually WebView One of them WebView. Son WebView Attach to parent WebView.
Vue The page will automatically overwrite the entire page , And use @ Message reception web View page communication ;
Nvue Page width and height should be specified , Use @onpostmessage receive web View page communication ;
app Vue Medium web View components do not support custom styles , but v-show The essence of is to change the component style . in other words , This component supports V-IF instead of V-show.
By default ,<web view> The component is full screen , And higher than the front-end components . The application side needs to use plus Specification to resize or overwrite the contents on it .
H5 Terminal web The view is actually converted to... Using the current browser iframe;
Application side IOS It is divided into uiwebview and wkwebview. since 2.2.5 Since version , The default is wkwebview;
Nvue web View must specify style width and height ;
Application web pages send real-time messages to applications ;
By default ,App nvue web The view has no size . You can set the size by style . If you want to fill the entire window , Can be flex Set to :
1. The title bar will not be in web The title is automatically displayed in the view page . If you want to fill the entire window and display the title , It is recommended to use Vue Page web View ( Unable to control the default full screen ), If you want to customize web Size of view , Please use nvue web View ;
If the argument is a string , You need to “ Single quotation marks ”. If the parameter is a numeric value , This parameter is not required . If there are no parameters , Just leave one ()
Use none / Call with no parameters and return values JS function
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); }});边栏推荐
- [software testing] basic knowledge of software testing you need to know
- leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]
- [sword finger offer] 53 - I. find the number I in the sorted array
- ABAP-发布Restful服务
- New skill: accelerate node through code cache JS startup
- Deep understanding of JVM (VI) -- garbage collection (III)
- 基于SSH的客户关系CRM管理系统
- TCP session hijacking based on hunt1.5
- Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
- 【剑指Offer】53 - I. 在排序数组中查找数字 I
猜你喜欢

vue3 响应式数据库—— reactive

Flutter custom component

The new Post-00 Software Test Engineer in 2022 is a champion

IEEE TBD SCI impact factor increased to 4.271, ranking Q1!

ABAP-发布Restful服务

Redis (IV) - delete policy

基於SSH的網上商城設計

NFT: 开启加密艺术时代的无限可能

Simulation of campus network design based on ENSP
![[Architecture] 1366- how to draw an excellent architecture diagram](/img/98/5dc29e08e91e751f67d910fadc6430.jpg)
[Architecture] 1366- how to draw an excellent architecture diagram
随机推荐
MIT science and Technology Review released the list of innovators under the age of 35 in 2022, including alphafold authors, etc
Lenovo's "dual platform" operation and maintenance solution helps to comprehensively improve the intelligent management ability of the intelligent medical industry
Key to understanding the trend of spot Silver
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
What will be the game changes brought about by the meta universe?
Is there an optimal solution to the energy consumption anxiety in the data center?
流批一体在京东的探索与实践
Deep understanding of JVM (II) - memory structure (II)
[Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
VS code 树视图 treeView
Apache 解析漏洞(CVE-2017-15715)_漏洞复现
[sword finger offer] sword finger offer 53 - ii Missing numbers from 0 to n-1
Exploration and practice of "flow batch integration" in JD
生成对抗网络,从DCGAN到StyleGAN、pixel2pixel,人脸生成和图像翻译。
Add code block in word (Reprint)
Design of online shopping mall based on SSH
基于SSH的网上商城设计
4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
Flutter custom component
Three methods of modifying time zone in MySQL