安卓客户端在公众号H5里调用wx.getLocalImgData,当上传多张图片的时候,会报错
https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 问题:上传一张图片时不报错,上传多张就会报错 报错信息:wx is not defined 代码如下: localIds.forEach((item, index) => {
wx.getLocalImgData({
localId: item, // 图片的localID
success: function (res) {
var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
if (localData.substr(0, 5) != 'data:') {
localData = 'data:image/jpeg;base64,' + localData;
}
},
fail: function (res) {
console.log("获取base64失败", res)
}
});
});