当前位置:网站首页>h5内嵌app,后和web如何进行通信?h5和web通信
h5内嵌app,后和web如何进行通信?h5和web通信
2022-07-17 02:00:00 【imkaifan】
// request
import {
webViewContent } from 'hybrid-webframework';
export default {
listen: (message, callback) => {
return webViewContent.listenMessage(message, callback);
},
send: (message, prama, listener) => {
return webViewContent.sendMessage(message, prama, listener);
}
};
封的几个通信
import request from '@/common/isapi/request-app';
export default {
getSession: callback => {
return request.send('GetToken', {
SiteID: 0
}, callback);
},
getLanguage: (callback) => {
return request.send('GetLguage', {
SiteID: 0
}, callback);
},
getUserPermission: callback => {
return request.send('Permission', {
SiteID: 0
}, callback);
},
onVehicleBIParams: (callback) => {
return request.listen('VParams', callback);
}
};
mobileClientAPI.getLanguage((info)=>{
this.lang = APP2WEB_LANGUAGE_KEY[info.Language] || 'en';
in18nLoader.setLanguage(this.lang);
});
commonApi.getUserPermission((res)=>{
let permiss = {
controlClientPermission: res.permissionInfo.controlClientPermission,
ebClientPermission: res.permissionInfo.webClientPermission,
resourcePermission: res.permissionInfo.resourcePermission
};
});
mobileReportClientAPI.onVehicleBIParams((res) => {
console.log('app传递的数据res', res);
})
边栏推荐
- Matlab在线性代数中的应用
- 374. Guess the size of numbers (must be able to get started)
- Properties of Gaussian distribution (including code)
- Underline shortcut
- Chengxin University envi_ The second week of IDL experiment content: extract aod+ in all MODIS aerosol products for detailed analysis
- [C语言勘误]数组长度的函数内获取方式错误
- How to read and write a single document based on MFC
- 通过Dao投票STI的销毁,SeekTiger真正做到由社区驱动
- Paper reading: u-net++: redesigning skip connections to exploit multiscale features in image segmentation
- Basic IDL content of note 1: common data types_ Create array_ Type conversion_ Print output_ Basic operation_ Relational operation
猜你喜欢

10. Redis interview FAQ

Thinkphp5.0模型操作使用page进行分页
当 mysql 表从压缩表变成普通表会发生什么?

Chengxin University envi_ IDL second week homework: extract aerosol thickness at n points + detailed analysis

通过OpenHarmony兼容性测评,大师兄开发板与丰富教培资源已ready

leetcode:50. Pow(x, n)

Gnome boxes virtual machine creation and installation

2022长三角数学建模:齿轮箱故障诊断

How to read and write a single document based on MFC

leetcode 222. Number of nodes of a complete binary tree (required)
随机推荐
STM32 serial port sending and receiving multiple data tutorial based on gas sensor practice
Matlab绘制激活函数sigmoid,Relu
机器学习库Scikit-Learn(线性模型、岭回归、插入一列数据(insert)、提取所需列、向量机(SVM)、聚类)
AI 之 OpenCvSharp 大圖找小圖(案例版)
Oracle queries the maximum partition of non self growing partition
神器网站目录,全都是刚需好用的网站
Laravel's problem
How to use iota keyword in go language
通过OpenHarmony兼容性测评,大师兄开发板与丰富教培资源已ready
leetcode162. 寻找峰值
MySQL 增删查改(基础)
动态管理内存的通讯录实现
Through openharmony compatibility evaluation, the big brother development board and rich teaching and training resources have been ready
Neural network learning notes 2.2 -- write a simple convolution neural network image classifier with MATLAB
Envi: (the most detailed tutorial in 2022) custom coordinate system
Go语言中的Iota关键字怎么使用
central limit theorem
一文搞懂│什么是跨域?如何解决跨域?
374. 猜数字大小(入门 必会)
Cmake common commands