wxml
<view class="title">传感器</view>
<view class="demo-box">
<view class="title">扫码</view>
<button type="primary" bindtap="scanCode">开始扫码</button>
<view class="status">字符集:{{res.charSet}}</view>
<view class="status">扫码类型:{{res.scanType}}</view>
<view class="status">扫码结果:{{res.result}}</view>
</view>
wxss
.status{
text-align: left;
margin: 15rpx;
}
js
Page({
data: {
},
scanCode:function(){
var that=this
wx.scanCode({
success:function(res){
that.setData({res:res})
}
})
},
)}