onHCEMessage无法触发和aid_list有关吗。。。
wx.onHCEMessage无法触发Page({ /** * 页面的初始数据 */ data: { text:'' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var _this=this wx.getHCEState({ success (res) { console.log(res.errCode,'1') if(res.errCode == 0){ wx.startHCE({ aid_list:['F222222222'], success (res) { console.log(res.errCode,'2') if(res.errCode == 0){ console.log(res.errCode,'2.1') wx.onHCEMessage(function(res) { console.log(res,res.errCode,'3') if (res.messageType === 1) { const buffer = new ArrayBuffer(111) const dataView = new DataView(buffer) dataView.setUint8(0, 0) wx.sendHCEMessage({ data: buffer, success:function(res){ console.log(res.errCode,'4') _this.setData({ text:res }) console.log(res,'success') }, fail:function(res){ _this.setData({ text:res }) console.log(res,'fail') } }) } }) } },fail(res){ console.log(res,'fail0') } }) } } }) } })
2023-02-18