scan: function(e) {
var that = this;
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log(JSON.stringify(res)); //{"result":"http://www.baidu.com","scanType":"QR_CODE","charSet":"utf8","path":"","errMsg":"scanCode:ok"}
console.log('条码类型:' + res.scanType); //条码类型
console.log('条码内容:' + res.result); //条码内容
that.result = res.result;
console.log(that.result)
},
fail: function(res) {
uni.showToast({
icon: 'none',
title: '请重新扫码'
})
}
});
},
0 个回复