//index.js//获取应用实例varappgetApp()Page({data:{show:"",},onLoad:function(){console.log('onLoad')},click:function(){varthatthis;varshow;wx.scanCode({success:(res){this.show"--result:"+res.result+"--scanType:"+res.scanType+"--charSet:"+res.charSet+"--path:"+res.path;that.setData({show:this.show})wx.showToast({title:'成功',icon:'success',duration:2000})},fail:(res){wx.showToast({title:'失败',icon:'success',duration:2000})},complete:(res){}.saoma{height:40px;width:110px;line-height:40px;margin-left:auto;margin-right:auto;color:#fff;background-color:#999;text-align:center;}.show{width:100%;color:#666;background-color:#fff;height:auto;}viewclass"container"viewclass"saoma"bindtap"click"点我扫一扫/viewviewclass"show"{{show}}/view/view1.

微信小程序,真机测试通过

TAG标签: 微信小程序扫一扫小程序获取扫一扫功能微信小程序扫一扫功能

http://www.xiaochengxub.com/read-96756.html