当前位置:网站首页>Advanced embedded application of uni app [day14]
Advanced embedded application of uni app [day14]
2022-07-24 03:25: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); }});边栏推荐
- 在openEuler社区开源的Embedded SIG,来聊聊它的多 OS 混合部署框架
- JIRA automation experience sharing for 2 years
- Express内置的中间件
- I developed an app similar to wechat runnable applet with fluent
- Services et configurations FTP
- The function of SIP account - tell you what is SIP line
- How emqx 5.0 under the new architecture of mria + rlog realizes 100million mqtt connections
- Network parameter management
- C user defined type details
- 正則錶達式 \b \B 深入淺出理解單詞邊界的匹配
猜你喜欢

正则表达式 \b \B 深入浅出理解单词边界的匹配

Genesis public chain: Tamp the foundation of Web 3.0 development

Write code, and multiple characters move from both ends to converge in the middle

Jump statements break and continue

Data Lake: comparative analysis of open source data Lake schemes deltalake, Hudi and iceberg

错误代码0x80004005

Lagrange polynomial

Programmers may still be programmers, and coders may only be coders

SolidWorks cannot reference references

Babylon.js cool canvas background animation JS special effects
随机推荐
The new idea 2022.2 was officially released, and the new features are nice
C language implementation of user login program
B. Eastern Exhibition- Codeforces Round #703 (Div. 2)
Basic syntax of MySQL DDL and DML and DQL
二分查找
Svn: e00002: can't convert string from 'UTF-8' to native encoding problem solving
Android开发——Kotlin语法之Lambda表达式
实现两个页面之前的通信(使用localStorage)
Tetris, 1
JS 数组 isAarray() typeof
FTP服务与配置
Basic knowledge of trigger (Part 2)
[C language] file operation
4.合宙Air32F103_LCD
Cache component status when Vue components are switched, that is, dynamic components keep alive dynamic components and asynchronous components
What is the security of Treasury reverse repo
SkyWalking分布式系统应用程序性能监控工具-上
Leetcode Hot 100 (topic 8) (232/88/451/offer10/offer22/344/)
JS array isaarray() typeof
QT custom class uses custom parametric signals and slots