当前位置:网站首页>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); }});边栏推荐
- 4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
- [zero basic IOT pwn] environment construction
- ASP. Net password encryption and password login
- Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole
- NFT: 开启加密艺术时代的无限可能
- 阿里云ECS导入本地,解决部署的问题
- Ten thousand volumes - list sorting [01]
- If you want to learn software testing, you must see series, 2022 software testing engineer's career development
- MySQL reports that the column timestamp field cannot be null
- 每日面试1题-如何防止CDN防护被绕过
猜你喜欢

腾讯持久化框架MMKV原理探究

MySQL之零碎知识点

构建基本buildroot文件系统

Customer relationship CRM management system based on SSH

Rainbow Brackets 插件的快捷键

Spin lock exploration

Deep understanding of JVM (VI) -- garbage collection (III)

Flutter custom component

New research of HKUST & MsrA: about image to image conversion, finishing is all you need

基于SSH的网上商城设计
随机推荐
如何写一个技术方案
MIT科技评论2022年35岁以下创新者名单发布,含AlphaFold作者等
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
Simulation of campus network design based on ENSP
Redis (III) - transaction
Flutter custom component
Switching routing (VLAN) experiment
K-line diagram must be read for quick start
Do fresh students get a job or choose a job after graduation?
【二叉树】前序遍历构造二叉搜索树
What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo
Fragmentary knowledge points of MySQL
leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]
ASP. Net generate verification code
How to write a technical proposal
巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...
[software testing] basic knowledge of software testing you need to know
ASP. Net password encryption and password login
MIT science and Technology Review released the list of innovators under the age of 35 in 2022, including alphafold authors, etc
基於SSH的網上商城設計