微信公开课
如何看待微信公开课小程序热门讨论「小程序调用蓝牙API问题」
摘要:小程序调用蓝牙API问题
展开:wx.openBluetoothAdapter({success:function(res){that.setData({msg:初始化蓝牙适配器成功!+JSON.stringify(res),})//监听蓝牙适配器状态wx.onBluetoothAdapterStateChange(function(res){that.setData({sousuo:res.discovering?在搜索。:未搜索。,status:res.available?可用。:不可用。,})})},complete:function(res){//completeconsole.log(res);}})这段代码,执行到了complete,输出内容为{errMsg:openBluetoothAdapter:failTypeError:CannotreadpropertyaddListenerofundefined}errMsg:openBluetoothAdapter:failTypeError:CannotreadpropertyaddListenerofundefined__proto__:Object网上查了下,并没类似的资料,有人碰到类似问题,说是一样的代码在之前的开发者工具调试就不会出这个问题了解更多