当前位置:网站首页>Vant3+ts H5 pages are nested into apps to communicate with native apps
Vant3+ts H5 pages are nested into apps to communicate with native apps
2022-06-12 17:48:00 【Enthusiastic learning】
The most recent project is vant3+ts It's done h5 Nested in app Inside , It has the function of scanning code and taking photos, and needs to be compatible with native app Interaction
The plug-ins used are dsBridge

stay
/**
* @Description Call camera scanning , Asynchronous call
* Returns the parameter : Is the value returned by scanning the code
scanCode yes APP Then change the method name of the definition ,str Is the returned parameter
*/
function getScanCode(callback: any) {
let res = ''
dsBridge.call('scanCode', function (str: any) {
res = str
callback(res)
})
return res
}
/**
* @Description Call the camera to take pictures and select pictures
* Returns the parameter : Is the value returned by scanning the code
takePhoto yes APP Then change the method name of the definition ,size Is to limit the number of sheets selected , Returns the project name and base64 character string
*/
function getPhoto(callback: any) {
let res = ''
dsBridge.call('takePhoto', {size:4}, function (_res) {
res = _res
callback(res)
})
return res
}
Where the page needs to be called Write it like this , Handle the logic you want
边栏推荐
猜你喜欢

How to win the "Olympic Games" in retail technology for jd.com, the learning tyrant of the "regular examination"?

Cesium parabolic equation

JDBC several pits

Hangzhou AI developer meetup registration opens!

淘宝Native研发模式的演进与思考 | DX研发模式

vant3+ts+pinia tab选项卡列表页面点击进详情,详情页返回tab高亮在原位置,刷新高亮默认在第一项

消息队列实战之队列优先级

SSM集成FreeMarker以及常用语法

论文《Deep Interest Evolution Network for Click-Through Rate Prediction》

Deep interest evolution network for click through rate prediction
随机推荐
Figma from getting started to giving up
Tcp/ip family structure and protocol of tcp/ip series overview
Detailed description of SQL cursor and example of internal recycling
Lambda - 1
Idea common shortcut keys
Understanding of binary search
Bug record: data truncation: incorrect datetime value:
论文《Deep Interest Evolution Network for Click-Through Rate Prediction》
App中快速复用微信登录授权的一种方法
Arm64栈回溯
Alibaba cloud image station supports IPv6!
JDBC快速入門教程
R language arma-garch-copula model and financial time series case
Vulnhub[DC3]
Byte flybook Human Resources Kit three sides
New media operation material website sharing enables you to create current affairs with half the effort
Hangzhou AI developer meetup registration opens!
Tidb Hackathon 2021 - pcloud: conduct icloud pcloud team interview on the database
Risc-v ide mounriver studio v1.60 update point introduction
Introduction to cookie usage