- 发布:2023-09-12 17:47
- 更新:2023-09-12 17:47
- 阅读:517
产品分类: uni小程序SDK
手机系统: 全部
手机厂商: 华为
页面类型: vue
SDK版本号: 3.8.12
测试过的手机:
示例代码:
export const handleMessage = () => {
uni.sendNativeEvent('getUserToken', {}, (res) => {
console.log('=sendNativeEvent==res==', res);
});
};
export const handleMessage = () => {
uni.sendNativeEvent('getUserToken', {}, (res) => {
console.log('=sendNativeEvent==res==', res);
});
};
操作步骤:
在安卓环境中,将uniapp的代码打包成wgt的方式,uniapp中有通过npm install xx引入包,包里面写了 uni.sendNativeEvent方法,但是回调参数为空
在安卓环境中,将uniapp的代码打包成wgt的方式,uniapp中有通过npm install xx引入包,包里面写了 uni.sendNativeEvent方法,但是回调参数为空
预期结果:
预期在安卓中也能拿到回调参数
预期在安卓中也能拿到回调参数
实际结果:
参数为空
参数为空
bug描述:
将uniapp打包成wgt的形式
-
通过uni.sendNativeEvent的方法和IOS交互没有问题
-
安卓环境有问题,回调能收到,但是【回调参数为空】,代码如下
export const handleMessage = () => { uni.sendNativeEvent('getUserToken', {}, (res) => { console.log('=sendNativeEvent==res==', res); }); };