《云开发控制台的日志内容》,如下:返回结果
{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"console.logI is not a function"}
日志
START RequestId: b95de49d-b2bc-11e9-a24c-525400b2c41b
Event RequestId: b95de49d-b2bc-11e9-a24c-525400b2c41b
TypeError: console.logI is not a function
at EventHandler.exports.main [as realHandler] (/var/user/index.js:10:11)
at EventHandler.handle (/var/runtime/node8/bootstrap.js:255:28)
at invoke (/var/runtime/node8/bootstrap.js:126:22)
at Timeout.setTimeout [as _onTimeout] (/var/runtime/node8/bootstrap.js:61:9)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
END RequestId: b95de49d-b2bc-11e9-a24c-525400b2c41b
// pages/scanCode/scanCode.js
Page({
/**
* 页面的初始数据
*/
data: {
},
scanCode: function (event) {
console.log(1)
// 允许从相机和相册扫码
wx.scanCode({
onlyFromCamera: true,
scanType: [‘barCode’],
success: res => {
console.log(res.result)
//
wx.cloud.callFunction({
// 要调用的云函数名称
name: ‘bookinfo’,
// 传递给云函数的参数
data: {
isbn: res.result
},
success: res => {
console.log(res)
},
fail: err => {
console.error(res)
}
})
},
fail: err => {
console.log(err);
}
})
}
})